diff options
Diffstat (limited to 'pjlib')
-rw-r--r-- | pjlib/include/pj/log.h | 3 | ||||
-rw-r--r-- | pjlib/src/pj/log.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/pjlib/include/pj/log.h b/pjlib/include/pj/log.h index 2d0961c9..89a0a660 100644 --- a/pjlib/include/pj/log.h +++ b/pjlib/include/pj/log.h @@ -78,7 +78,8 @@ enum pj_log_decoration PJ_LOG_HAS_NEWLINE = 128, /**< Terminate each call with newline [yes] */ PJ_LOG_HAS_CR = 256, /**< Include carriage return [no] */ PJ_LOG_HAS_SPACE = 512, /**< Include two spaces before log [yes] */ - PJ_LOG_HAS_COLOR = 1024 /**< Colorize logs [yes on win32] */ + PJ_LOG_HAS_COLOR = 1024, /**< Colorize logs [yes on win32] */ + PJ_LOG_HAS_LEVEL_TEXT = 2048 /**< Include level text string [no] */ }; /** diff --git a/pjlib/src/pj/log.c b/pjlib/src/pj/log.c index 863d868d..163b545a 100644 --- a/pjlib/src/pj/log.c +++ b/pjlib/src/pj/log.c @@ -168,6 +168,12 @@ PJ_DEF(void) pj_log( const char *sender, int level, pj_time_decode(&now, &ptime); pre = log_buffer; + if (log_decor & PJ_LOG_HAS_LEVEL_TEXT) { + static const char *ltexts[] = { "FATAL:", "ERROR:", " WARN:", + " INFO:", "DEBUG:", "TRACE:", "DETRC:"}; + pj_ansi_strcpy(pre, ltexts[level]); + pre += 6; + } if (log_decor & PJ_LOG_HAS_DAY_NAME) { static const char *wdays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; |