DEBUG_PRINT now a define, resolves linking issues.

Using log name as logcat tag now.
Removed log name from default android log formatting.
This commit is contained in:
Armin Novak 2014-08-07 21:51:52 +02:00
parent eecc8e2333
commit e6ed76977a
3 changed files with 18 additions and 7 deletions

View File

@ -22,15 +22,26 @@
#include <winpr/wlog.h>
void debug_print(int level, const char *file, const char *fkt, int line,
const char *dbg_str, const char *fmt, ...);
#define DEBUG_PRINT(level, file, fkt, line, dbg_str, fmt, ...) \
do { \
wLog *log = WLog_Get("com.freerdp." dbg_str); \
wLogMessage msg; \
\
msg.Type = WLOG_MESSAGE_TEXT; \
msg.Level = level; \
msg.FormatString = fmt; \
msg.LineNumber = line; \
msg.FileName = file; \
msg.FunctionName = fkt; \
WLog_PrintMessage(log, &msg, ##__VA_ARGS__); \
} while (0 )
#define DEBUG_NULL(fmt, ...) do { } while (0)
#define DEBUG_CLASS(_dbg_class, fmt, ...) debug_print(WLOG_ERROR, __FILE__, \
#define DEBUG_CLASS(_dbg_class, fmt, ...) DEBUG_PRINT(WLOG_ERROR, __FILE__, \
__FUNCTION__, __LINE__, #_dbg_class, fmt, ## __VA_ARGS__)
#define DEBUG_MSG(fmt, ...) debug_print(WLOG_DEBUG, __FILE__, __FUNCTION__, \
#define DEBUG_MSG(fmt, ...) DEBUG_PRINT(WLOG_DEBUG, __FILE__, __FUNCTION__, \
__LINE__, "freerdp", fmt, ## __VA_ARGS__)
#define DEBUG_WARN(fmt, ...) debug_print(WLOG_ERROR, __FILE__, __FUNCTION__, \
#define DEBUG_WARN(fmt, ...) DEBUG_PRINT(WLOG_ERROR, __FILE__, __FUNCTION__, \
__LINE__, "freerdp", fmt, ## __VA_ARGS__)
#endif /* FREERDP_UTILS_DEBUG_H */

View File

@ -120,7 +120,7 @@ int WLog_ConsoleAppender_WriteMessage(wLog* log, wLogConsoleAppender* appender,
}
if (level != ANDROID_LOG_SILENT)
__android_log_print(level, "winpr", "%s%s", message->PrefixString, message->TextString);
__android_log_print(level, log->Name, "%s%s", message->PrefixString, message->TextString);
#else
fp = (appender->outputStream == WLOG_CONSOLE_STDERR) ? stderr : stdout;

View File

@ -358,7 +358,7 @@ wLogLayout* WLog_Layout_New(wLog* log)
else
{
#ifdef ANDROID
layout->FormatString = _strdup("[%mn][pid=%pid:tid=%tid]");
layout->FormatString = _strdup("[pid=%pid:tid=%tid] - ");
#else
layout->FormatString = _strdup("[%hr:%mi:%se:%ml] [%pid:%tid] [%lv][%mn] - ");
#endif