Asterisk - The Open Source Telephony Project GIT-master-0644429
|
Macros | |
#define | _TRACE_PREFIX_ _TRACE_PREFIX_DEFAULT_ |
#define | _TRACE_PREFIX_DEFAULT_ _A_ |
#define | ast_trace(level, ...) ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__) |
#define | ast_trace_dec_indent() |
#define | ast_trace_get_indent() (0) |
#define | ast_trace_inc_indent() |
#define | ast_trace_log(__level, __log_level, ...) |
#define | ast_trace_raw(level, indent_type, ...) ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__) |
#define | ast_trace_set_indent(indent) |
#define | SCOPE_CALL(level, __funcname, ...) __funcname(__VA_ARGS__) |
#define | SCOPE_CALL_WITH_INT_RESULT(level, __funcname, ...) __funcname(__VA_ARGS__) |
#define | SCOPE_CALL_WITH_RESULT(level, __var, __funcname, ...) __var = __funcname(__VA_ARGS__) |
#define | SCOPE_ENTER(level, ...) |
#define | SCOPE_ENTER_TASK(level, indent, ...) |
#define | SCOPE_EXIT(...) ast_debug(__scope_level, " " __VA_ARGS__) |
#define | SCOPE_EXIT_EXPR(__expr, ...) |
#define | SCOPE_EXIT_LOG(__log_level, ...) |
#define | SCOPE_EXIT_LOG_EXPR(__expr, __log_level, ...) |
#define | SCOPE_EXIT_LOG_RTN(__log_level, ...) |
#define | SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level, ...) |
#define | SCOPE_EXIT_RTN(...) |
#define | SCOPE_EXIT_RTN_VALUE(__return_value, ...) |
#define | SCOPE_TRACE(__level, ...) |
#define | TRACE_ATLEAST(level) |
Enumerations | |
enum | ast_trace_indent_type { AST_TRACE_INDENT_SAME = 0 , AST_TRACE_INDENT_INC_BEFORE , AST_TRACE_INDENT_INC_AFTER , AST_TRACE_INDENT_DEC_BEFORE , AST_TRACE_INDENT_DEC_AFTER , AST_TRACE_INDENT_PROVIDED , AST_TRACE_INDENT_NONE } |
Controls if and when indenting is applied. More... | |
Functions | |
void | ast_init_logger_for_socket_console (void) |
load logger.conf configuration for console socket connections More... | |
unsigned int | ast_trace_get_by_module (const char *module) |
Get the trace level for a module. More... | |
CLI> core set trace <trace_level> [ module ]
Simple Example: The following code...
would produce...
[2020-05-17 15:16:51 -0600] TRACE[953402] : --> res_pjsip_session.c:4283 create_local_sdp PJSIP/1173-00000001 [2020-05-17 15:16:51 -0600] TRACE[953402] : <-- res_pjsip_session.c:4283 create_local_sdp PJSIP/1173-00000001There is one odd bit. There's no way to capture the line number of there the scope exited so it's always going to be the line where SCOPE_TRACE is located.
TRACE[953402] : --> res_pjsip_session.c:3940 session_inv_on_tsx_state_changed PJSIP/1173-00000001 TSX State: Proceeding Inv State: CALLING TRACE[953402] : --> res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001 TRACE[953402] : --> res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 TRACE[953402] : --> res_pjsip_session.c:3669 handle_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 Supplement: chan_pjsip TRACE[953402] : --> chan_pjsip.c:3265 chan_pjsip_incoming_response_after_media PJSIP/1173-00000001 Method: INVITE Status: 100 After Media TRACE[953402] : --> chan_pjsip.c:3194 chan_pjsip_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 TRACE[953402] : chan_pjsip.c:3245 chan_pjsip_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 Ignored TRACE[953402] : <-- chan_pjsip.c:3194 chan_pjsip_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 TRACE[953402] : <-- chan_pjsip.c:3265 chan_pjsip_incoming_response_after_media PJSIP/1173-00000001 Method: INVITE Status: 100 After Media TRACE[953402] : <-- res_pjsip_session.c:3669 handle_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 Supplement: chan_pjsip TRACE[953402] : <-- res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173-00000001 Method: INVITE Status: 100 TRACE[953402] : <-- res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001 TRACE[953402] : <-- res_pjsip_session.c:3940 session_inv_on_tsx_state_changed PJSIP/1173-00000001 TSX State: Proceeding Inv State: CALLING
"filename:line function"
which is defined in the macro _A_
at the top of this file: They become 3 arguments to the __ast_trace function and most of the ast_log* functions. For scope tracing, that may be unnecessary clutter in the trace output so you can now customise that with the _TRACE_PREFIX_
macro. Like _A_
, it MUST resolve to 3 arguments:
const char *, int, const char *
so the minimum would be:
Normally you should define _TRACE_PREFIX_
in your source file before including logger.h.
You can also define it later in your source file but because logger.h sets it to a default value, you'll have to undefine it first, then define it your your liking. If you want to go back to the default, you'll have to undefine it again, then define it to _TRACE_PREFIX_DEFAULT_
.
_TRACE_PREFIX_
in one source file does NOT make it apply to any others. So if you define it in source file A, then call a function in source file B, the trace output from B will display based on how _TRACE_PREFIX_
is defined in B, not A. #define _TRACE_PREFIX_ _TRACE_PREFIX_DEFAULT_ |
Definition at line 670 of file include/asterisk/logger.h.
#define _TRACE_PREFIX_DEFAULT_ _A_ |
Definition at line 668 of file include/asterisk/logger.h.
#define ast_trace | ( | level, | |
... | |||
) | ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__) |
Definition at line 1000 of file include/asterisk/logger.h.
#define ast_trace_dec_indent | ( | ) |
Definition at line 1006 of file include/asterisk/logger.h.
#define ast_trace_get_indent | ( | ) | (0) |
Definition at line 1003 of file include/asterisk/logger.h.
#define ast_trace_inc_indent | ( | ) |
Definition at line 1005 of file include/asterisk/logger.h.
#define ast_trace_log | ( | __level, | |
__log_level, | |||
... | |||
) |
Definition at line 1072 of file include/asterisk/logger.h.
#define ast_trace_raw | ( | level, | |
indent_type, | |||
... | |||
) | ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__) |
Definition at line 997 of file include/asterisk/logger.h.
#define ast_trace_set_indent | ( | indent | ) |
Definition at line 1004 of file include/asterisk/logger.h.
#define SCOPE_CALL | ( | level, | |
__funcname, | |||
... | |||
) | __funcname(__VA_ARGS__) |
Definition at line 1017 of file include/asterisk/logger.h.
#define SCOPE_CALL_WITH_INT_RESULT | ( | level, | |
__funcname, | |||
... | |||
) | __funcname(__VA_ARGS__) |
Definition at line 1023 of file include/asterisk/logger.h.
#define SCOPE_CALL_WITH_RESULT | ( | level, | |
__var, | |||
__funcname, | |||
... | |||
) | __var = __funcname(__VA_ARGS__) |
Definition at line 1020 of file include/asterisk/logger.h.
#define SCOPE_ENTER | ( | level, | |
... | |||
) |
Definition at line 1009 of file include/asterisk/logger.h.
#define SCOPE_ENTER_TASK | ( | level, | |
indent, | |||
... | |||
) |
Definition at line 1013 of file include/asterisk/logger.h.
#define SCOPE_EXIT | ( | ... | ) | ast_debug(__scope_level, " " __VA_ARGS__) |
Definition at line 1026 of file include/asterisk/logger.h.
#define SCOPE_EXIT_EXPR | ( | __expr, | |
... | |||
) |
Definition at line 1029 of file include/asterisk/logger.h.
#define SCOPE_EXIT_LOG | ( | __log_level, | |
... | |||
) |
The following macros will print log messages before running the associated SCOPE_ macro.
Definition at line 1048 of file include/asterisk/logger.h.
#define SCOPE_EXIT_LOG_EXPR | ( | __expr, | |
__log_level, | |||
... | |||
) |
Definition at line 1066 of file include/asterisk/logger.h.
#define SCOPE_EXIT_LOG_RTN | ( | __log_level, | |
... | |||
) |
Definition at line 1054 of file include/asterisk/logger.h.
#define SCOPE_EXIT_LOG_RTN_VALUE | ( | __value, | |
__log_level, | |||
... | |||
) |
Definition at line 1060 of file include/asterisk/logger.h.
#define SCOPE_EXIT_RTN | ( | ... | ) |
Definition at line 1033 of file include/asterisk/logger.h.
#define SCOPE_EXIT_RTN_VALUE | ( | __return_value, | |
... | |||
) |
Definition at line 1037 of file include/asterisk/logger.h.
#define SCOPE_TRACE | ( | __level, | |
... | |||
) |
Definition at line 1007 of file include/asterisk/logger.h.
#define TRACE_ATLEAST | ( | level | ) |
Definition at line 685 of file include/asterisk/logger.h.
Controls if and when indenting is applied.
Definition at line 694 of file include/asterisk/logger.h.
void ast_init_logger_for_socket_console | ( | void | ) |
load logger.conf configuration for console socket connections
Definition at line 713 of file logger.c.
References ast_config_destroy(), ast_config_load2(), ast_copy_string(), ast_variable_retrieve(), CONFIG_STATUS_FILEINVALID, and dateformat.
Referenced by ast_remotecontrol().
unsigned int ast_trace_get_by_module | ( | const char * | module | ) |
Get the trace level for a module.
module | the name of module |
Definition at line 153 of file main/cli.c.
References AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, module_level::level, and trace_modules.