4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
7 * Mahendra Kumar Prajapat <mahendra.p@samsung.com>
8 * Harsha Shekar <h.shekar@samsung.com>
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
26 * @file drm_trusted_client_log.h
27 * @brief DRM Trusted Client log specific file.
28 * @author Harsha Shekar (h.shekar@samsung.com)
30 * @history 0.1: DRM LOG definitions.
33 #ifndef __DRM_TRUSTED_CLIENT_LOG_H__
34 #define __DRM_TRUSTED_CLIENT_LOG_H__
38 #endif /*__cplusplus */
40 #include <sys/types.h>
42 #include <sys/syscall.h>
43 #include <linux/unistd.h>
47 #define drmtrustedclientgettid() (long int)syscall(__NR_gettid)
48 #define DRM_TRUSTED_CLIENT_FILENAME(X) (strrchr((char *)(X), '/') ? (char *)(strrchr((char*)(X), '/') + 1) : ((char *)(X)))
51 * Enable this flag to use internal logging mechanism
53 //#define __DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__
55 #ifdef __DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__
57 /* Use internal logging mechanism */
58 extern const char *__progname;
60 #define DRM_TRUSTED_CLIENT_LOG(FMT, ARG...) do{ \
61 fprintf(stderr, "\n [EXE name=%s]:[PID=%ld]:[TID=%ld]:[%s:%s:%d]:", __progname, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__); \
62 fprintf(stderr, FMT, ##ARG); \
63 fprintf(stderr,"\n"); \
66 #define DRM_TRUSTED_CLIENT_EXCEPTION(FMT, ARG...) do{ \
67 fprintf(stderr, "\n [EXE name=%s]:[PID=%ld]:[TID=%ld]:[%s:%s:%d]:[DRM-ERROR-CLIENT]:", __progname, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__); \
68 fprintf(stderr, FMT, ##ARG); \
69 fprintf(stderr,"\n"); \
72 #define DRM_TRUSTED_CLIENT_FRQ_LOG DRM_TRUSTED_CLIENT_LOG
74 #else /*__DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__ */
76 /* Use DLOG logging mechanism */
79 /* DRM Trusted Client layer debug messages*/
80 #define TAG_DRM_TRUSTED_CLIENT "DRM_TRUSTED_CLIENT"
83 DEBUG Debug message. - always compiled into application, but not logged at run time by default on release mode. on debug mode, this message will be logged at run time.
84 INFO Information message - Normal operational messages. above of this priority will always be logged.
85 WARN Warning messages - not an error, but indication that an error will occur if action is not taken
86 ERROR Error message - indicate error.
89 /* Trusted Client layer related logs */
90 #define DRM_TRUSTED_CLIENT_LOG(FMT, ARG...) SLOG(LOG_INFO, TAG_DRM_TRUSTED_CLIENT, "[PID=%ld]:[TID=%ld]:[%s:%s:%d]:"FMT, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__, ##ARG);
91 #define DRM_TRUSTED_CLIENT_FRQ_LOG(FMT, ARG...) SLOG(LOG_DEBUG, TAG_DRM_TRUSTED_CLIENT, "[PID=%ld]:[TID=%ld]:[%s:%s:%d]:"FMT, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__, ##ARG);
92 #define DRM_TRUSTED_CLIENT_EXCEPTION(FMT, ARG...) SLOG(LOG_ERROR, TAG_DRM_TRUSTED_CLIENT, "[PID=%ld]:[TID=%ld]:[%s:%s:%d]:[DRM-ERROR-CLIENT]"FMT"\n", (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__, ##ARG);
94 #endif /* __DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__ */
98 #endif /* __cplusplus */
100 #endif /* __DRM_TRUSTED_CLIENT_LOG_H__*/