diff --git a/include/freerdp/utils/debug.h b/include/freerdp/utils/debug.h index 50764c0a1..dde132dd4 100644 --- a/include/freerdp/utils/debug.h +++ b/include/freerdp/utils/debug.h @@ -22,15 +22,26 @@ #include -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 */ diff --git a/winpr/libwinpr/utils/wlog/ConsoleAppender.c b/winpr/libwinpr/utils/wlog/ConsoleAppender.c index bc7c1f23d..356ca4576 100644 --- a/winpr/libwinpr/utils/wlog/ConsoleAppender.c +++ b/winpr/libwinpr/utils/wlog/ConsoleAppender.c @@ -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; diff --git a/winpr/libwinpr/utils/wlog/Layout.c b/winpr/libwinpr/utils/wlog/Layout.c index 96365fe3e..43670d0d0 100644 --- a/winpr/libwinpr/utils/wlog/Layout.c +++ b/winpr/libwinpr/utils/wlog/Layout.c @@ -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