Opened 13 years ago
Last modified 13 years ago
#1372 closed enhancement
New log features: indentation and thread switching indication — at Version 1
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | normal | Milestone: | release-2.0-alpha2 |
Component: | common | Version: | trunk |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: |
Description (last modified by bennylp)
1. Indentation
Indentation of log message to show function depth. Example:
21:13:35.787 pjsua_call.c Answering call 1: code=200 21:13:35.787 pjsua_media.c ...Call 1: updating media.. 21:13:35.787 pjsua_media.c .....Media session call01:0 is destroyed 21:13:35.787 pjsua_media.c ....Audio channel update.. 21:13:35.787 strm0x22f04d8 .....VAD temporarily disabled 21:13:35.788 strm0x22f04d8 .....Encoder stream started 21:13:35.788 strm0x22f04d8 .....Decoder stream started 21:13:35.788 pjsua_app.c ...Call 1 media 0 [type=audio], status is Active 21:13:35.788 pjsua_media.c ...Conf disconnect: 2 -x- 0 21:13:35.788 pjsua_media.c ...Conf connect: 3 --> 0 21:13:35.788 pjsua_media.c ...Conf connect: 0 --> 3
Use pj_log_push_indent() and pj_log_pop_indent() to use this new feature. The PJ_LOG_HAS_INDENT must be set in the log decoration flag (it is set by default by PJSUA-LIB).
Also two new macros to customize the behavior: PJ_LOG_INDENT_SIZE, and PJ_LOG_INDENT_CHAR.
2. Thread Switch Indication
An exclamation mark will be placed before the log message if the caller thread is different than the previous message.
Example:
21:13:35.788 strm0x22f04d8 .....Decoder stream started 21:13:35.788 udp0x22deab0 !Remote RTCP address switched to 10.0.0.2:40003 21:13:35.788 pjsua_media.c !.....Audio updated, stream #0: speex (sendrecv) 21:13:35.788 pjsua_app.c ...Call 1 media 0 [type=audio], status is Active 21:13:35.788 pjsua_media.c ...Conf disconnect: 2 -x- 0
This feature is controlled by the new PJ_LOG_HAS_THREAD_SWC log decor. It is set by default by PJSUA-LIB.