diff options
Diffstat (limited to 'pjlib')
-rw-r--r-- | pjlib/include/pj/config.h | 4 | ||||
-rw-r--r-- | pjlib/include/pj/log.h | 1 | ||||
-rw-r--r-- | pjlib/src/pj/config.c | 2 | ||||
-rw-r--r-- | pjlib/src/pj/log.c | 9 |
4 files changed, 11 insertions, 5 deletions
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h index 205df1da..b836b53b 100644 --- a/pjlib/include/pj/config.h +++ b/pjlib/include/pj/config.h @@ -175,10 +175,10 @@ * This may affect the stack usage, depending whether PJ_LOG_USE_STACK_BUFFER * flag is set. * - * Default: 800 + * Default: 1500 */ #ifndef PJ_LOG_MAX_SIZE -# define PJ_LOG_MAX_SIZE 800 +# define PJ_LOG_MAX_SIZE 1500 #endif /** diff --git a/pjlib/include/pj/log.h b/pjlib/include/pj/log.h index 1cdf8577..2c706f9c 100644 --- a/pjlib/include/pj/log.h +++ b/pjlib/include/pj/log.h @@ -112,6 +112,7 @@ typedef void pj_log_func(int level, const char *data, int len); /** * Default logging writer function used by front end logger function. + * This function will print the log message to stdout only. * Application normally should NOT need to call this function, but * rather use the PJ_LOG macro. * diff --git a/pjlib/src/pj/config.c b/pjlib/src/pj/config.c index 8d14a114..40865684 100644 --- a/pjlib/src/pj/config.c +++ b/pjlib/src/pj/config.c @@ -21,7 +21,7 @@ #include <pj/ioqueue.h> static const char *id = "config.c"; -const char *PJ_VERSION = "0.5"; +const char *PJ_VERSION = "0.5.1"; PJ_DEF(void) pj_dump_config(void) { diff --git a/pjlib/src/pj/log.c b/pjlib/src/pj/log.c index 442ee942..066e765f 100644 --- a/pjlib/src/pj/log.c +++ b/pjlib/src/pj/log.c @@ -73,7 +73,7 @@ PJ_DEF(void) pj_log( const char *sender, int level, #if PJ_LOG_USE_STACK_BUFFER char log_buffer[PJ_LOG_MAX_SIZE]; #endif - int len; + int len, print_len; PJ_CHECK_STACK(); @@ -137,7 +137,12 @@ PJ_DEF(void) pj_log( const char *sender, int level, len = pre - log_buffer; /* Print the whole message to the string log_buffer. */ - len = len + vsnprintf(pre, sizeof(log_buffer)-len, format, marker); + print_len = vsnprintf(pre, sizeof(log_buffer)-len, format, marker); + if (print_len < 0) { + print_len = pj_snprintf(pre, sizeof(log_buffer)-len, + "<logging error: msg too long>"); + } + len = len + print_len; if (len > 0 && len < sizeof(log_buffer)-2) { if (log_decor & PJ_LOG_HAS_CR) { log_buffer[len++] = '\r'; |