4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #ifndef __TCORE_LOG_H__
22 #define __TCORE_LOG_H__
26 #ifdef FEATURE_DLOG_DEBUG
31 #define TCORE_LOG_TAG "UNKNOWN"
34 #define info(fmt,args...) do { RLOG(LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
35 #define msg(fmt,args...) do { RLOG(LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
36 #define dbg(fmt,args...) do { RLOG(LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
37 #define warn(fmt,args...) do { RLOG(LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
38 #define err(fmt,args...) do { RLOG(LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
40 #elif defined(FEATURE_TLOG_DEBUG)
43 #define TCORE_LOG_TAG "UNKNOWN"
47 TCORE_LOG_TYPE_MAIN = 0,
52 enum tcore_log_priority {
53 TCORE_LOG_UNKNOWN = 0,
65 * Virtual log function.
66 * Daemon should implement the actual content. (printrf/file writing/...)
68 void tcore_log(enum tcore_log_type type, enum tcore_log_priority priority, const char *tag, const char *fmt, ...);
70 #define info(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_INFO, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
71 #define msg(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, fmt "\n", ##args); } while(0)
72 #define dbg(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_DEBUG, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
73 #define warn(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_WARN, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
74 #define err(fmt,args...) do { tcore_log(TCORE_LOG_TYPE_RADIO, TCORE_LOG_FATAL, TCORE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while(0)
78 #define ANSI_COLOR_NORMAL "\e[0m"
80 #define ANSI_COLOR_BLACK "\e[0;30m"
81 #define ANSI_COLOR_RED "\e[0;31m"
82 #define ANSI_COLOR_GREEN "\e[0;32m"
83 #define ANSI_COLOR_BROWN "\e[0;33m"
84 #define ANSI_COLOR_BLUE "\e[0;34m"
85 #define ANSI_COLOR_MAGENTA "\e[0;35m"
86 #define ANSI_COLOR_CYAN "\e[0;36m"
87 #define ANSI_COLOR_LIGHTGRAY "\e[0;37m"
89 #define ANSI_COLOR_DARKGRAY "\e[1;30m"
90 #define ANSI_COLOR_LIGHTRED "\e[1;31m"
91 #define ANSI_COLOR_LIGHTGREEN "\e[1;32m"
92 #define ANSI_COLOR_YELLOW "\e[1;33m"
93 #define ANSI_COLOR_LIGHTBLUE "\e[1;34m"
94 #define ANSI_COLOR_LIGHTMAGENTA "\e[1;35m"
95 #define ANSI_COLOR_LIGHTCYAN "\e[1;36m"
96 #define ANSI_COLOR_WHITE "\e[1;37m"
98 #ifndef TCORE_LOG_FILE
99 #define TCORE_LOG_FILE stdout
102 #ifndef TCORE_LOG_FUNC
103 #define TCORE_LOG_FUNC fprintf
106 #define info(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); } while(0)
107 #define msg(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, fmt "\n", ##args); fflush(TCORE_LOG_FILE); } while(0)
108 #define dbg(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0)
109 #define warn(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0)
110 #define err(fmt,args...) do { TCORE_LOG_FUNC(TCORE_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TCORE_LOG_FILE); } while(0)