8292f2eac15e5d200aa50d2eaf4c84fbe77ff3c8
[platform/framework/native/appfw.git] / src / base / inc / FBase_Log.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FBase_Log.h
19  * @brief               This file is internal header for Log.
20  */
21 #ifndef _FBASE_INTERNAL_LOG_H_
22 #define _FBASE_INTERNAL_LOG_H_
23
24 #include <stdarg.h>
25 #include <FOspConfig.h>
26 #include <FBaseDataType.h>
27 #include <FIoRegistry.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif // __cplusplus
32
33 #define LOG_MODULE_NAME_LEN_MAX 30
34 #define LOG_TAG_LEN_MAX 50
35 #define LOG_LEN_MAX 1024
36 #define PROPAGATION_LEN_MAX 512
37
38 #define NID_MAX 200
39
40 /**
41  * LogEntry
42  *
43  */
44 typedef struct LogEntry
45 {
46         int logID;
47         char logIDName[LOG_MODULE_NAME_LEN_MAX];
48         char logModuleName[LOG_MODULE_NAME_LEN_MAX];
49         bool loggingEnabled;
50 } LogEntry;
51
52 /**
53  * LogInfo
54  */
55 typedef struct LogInfo
56 {
57         LogEntry logTable[NID_MAX];
58
59         bool consoleOut;
60         bool fileOut;
61
62         bool platformInfoEnabled;
63         bool platformExceptionEnabled;
64
65         bool applicationInfoEnabled;
66         bool applicationDebugEnabled;
67         bool applicationExceptionEnabled;
68 } LogInfo;
69
70 /**
71  * Log Types
72  */
73 enum _LogType
74 {
75         LOG_INFO = 10,
76         LOG_DEBUG = 11,
77         LOG_EXCEPTION = 12,
78         LOG_USER = 13
79 };
80
81 void __PrintLog(_LogType type, const char* pFunction, int lineNumber, const char* pFormat, va_list args);
82 void __PrintLogTag(const char* pTag, _LogType type, const char* pFunction, int lineNumber, const char* pFormat, va_list args);
83 void __PrintSysLog(_LogType type, LogID id, const char* pFunction, int lineNumber, const char* pFormat, va_list args);
84 void __PrintSysLogTag(const char* pTag, _LogType type, LogID id, const char* pFunction, int lineNumber, const char* pFormat, va_list args);
85
86 char* __GetModuleName(LogID id);
87 bool __GetEnableInfo(LogID id);
88
89 void __InitializeLogInfo(void);
90 void __InitializeLogLevel(const Tizen::Io::Registry& reg);
91 void __InitializePlatformModule(const Tizen::Io::Registry& reg);
92
93 #ifdef __cplusplus
94 }
95 #endif // __cplusplus
96 #endif // _FBASE_INTERNAL_LOG_H_