#include <stdint.h>
#define LOG_FMT "[%s][%s:%d]%s\n"
+#define MAX_TAG_LENGTH 256
/*-----------------------------------------------------------------------------
* Globals
}
#endif
-void PrintLog(IN const char *tag, IN const char *function_name,
- IN const int32_t line_no, IN int32_t module_level,
- IN LogLevel log_level, IN const char *message,
- va_list variable_list)
+int PrintLog(IN const char *tag, IN const char *function_name,
+ IN const int32_t line_no, IN int32_t module_level,
+ IN LogLevel log_level, IN const char *message,
+ va_list variable_list)
{
if (!(module_level & gmodule_level)
|| log_level > glog_level)
- return;
+ return 0;
+ int ret_len = 0;
+ int ret;
const char *module = getModuleLevelString(module_level);
char buf[512] = {'\0'};
vsnprintf(buf, sizeof(buf), message, variable_list);
#if defined(__TIZEN__)
log_priority prio = logLevelToDlogLevel(log_level);
- dlog_print(prio, tag, LOG_FMT,
- module, function_name, line_no, buf);
+ ret = dlog_print(prio, tag, LOG_FMT,
+ module, function_name, line_no, buf);
#elif defined(_ANDROID_NDK)
android_LogPriority prio = logLevelToAndroidLogLevel(log_level);
- __android_log_print(prio, tag, LOG_FMT,
- module, function_name, line_no, buf);
+ ret = __android_log_print(prio, tag, LOG_FMT,
+ module, function_name, line_no, buf);
#else
const char *severity = getDebugLevelString(log_level);
- printf("[%s] [%s]"LOG_FMT, tag, severity, module, function_name,
- line_no, buf);
+ ret = printf("[%s] [%s]"LOG_FMT, tag, severity, module, function_name,
+ line_no, buf);
#endif
+ if (ret >= 0)
+ ret_len += ret;
+ return ret_len;
}
__attribute__((visibility("default")))
IN int32_t module_level, IN int32_t log_level,
IN const char* message, ...);
-void PrintLog(IN const char *tag, IN const char *function_name,
- IN const int32_t line_no, IN int32_t module_level,
- IN LogLevel log_level, IN const char *message,
- va_list variable_list);
+int PrintLog(IN const char *tag, IN const char *function_name,
+ IN const int32_t line_no, IN int32_t module_level,
+ IN LogLevel log_level, IN const char *message,
+ va_list variable_list);
#if defined(__cplusplus)
} // extern "C"
#endif
const int line, ...)
{
LogLevel ta_log_level = taLogLevelToLogLevel(lv);
+ int ret;
if (fmt == NULL || function == NULL)
return 0;
va_list args;
va_start(args, line);
- PrintLog(log_label, function, line, MODULE_CLIENT_TA, ta_log_level, fmt, args);
+ ret = PrintLog(log_label, function, line, MODULE_CLIENT_TA,
+ ta_log_level, fmt, args);
va_end(args);
- return 0; // TODO
+ return ret;
}
void initDebugLogLevel(const char* fmt, ...)