_ _ _ ____ ___ | | ___ __ _ __ _(_)_ __ __ _ / \ | _ \_ _| | | / _ \ / _` |/ _` | | '_ \ / _` | / _ \ | |_) | | | |__| (_) | (_| | (_| | | | | | (_| | / ___ \| __/| | |_____\___/ \__, |\__, |_|_| |_|\__, | /_/ \_\_| |___| |___/ |___/ |___/ Ondrej Martinek January 2009 This document contains the short description of the logging API in Kamailio for developers. Source files: dprint.h dprint.c Compile-time control macros ============================= NO_LOG If defined, logging is completely disabled in SER and no messages are produced at all NO_DEBUG If defined, logging messages do not include the source filename and line location info Logging levels ================ L_DBG ... Debugging message (the lowest level) L_INFO ... Info message L_WARN ... Warning message L_ERR ... Error message L_CRIT ... Critical message L_ALERT ... Alert message (the highest level) The levels are implemented as integer macros. Related variables =================== debug The config.framework setting that contains the current logging level. The initial value can be specified by "debug" parameter in ser.cfg or by -d options on the command-line. The default value is L_WARN. log_stderror The global variable which specifies whether the log messages should be send to the standard error output or syslog (equals to zero). Its value can be specified by "log_stderr" parameter in ser.cfg or -E option on the command-line. log_facility The config.framework setting that contains the current facility for logging to syslog. The initial value can be specified by "log_facility" parameter in ser.cfg. The default value is LOG_DAEMON. Macro functions ================= * short macro aliases: DBG(FMT, ARGS...) alias for LOG(L_DBG, FMT, ARGS...) INFO(FMT, ARGS...) alias for LOG(L_INFO, FMT, ARGS...) WARN(FMT, ARGS...) alias for LOG(L_WARN, FMT, ARGS...) ERR(FMT, ARGS...) alias for LOG(L_ERR, FMT, ARGS...) BUG(FMT, ARGS...) alias for LOG(L_CRIT, FMT, ARGS...) ALERT(FMT, ARGS...) alias for LOG(L_ALERT, FMT, ARGS...) * LOG(LEVEL, FMT, ARGS...) macro Prints the log message on stderr or syslog if the current debug level is greater or equal to LEVEL. The message has the following format: - for messages by core: PROC(PID) LEVEL: [FILE:LINE]: MESSAGE - for messages by modules: PROC(PID) LEVEL: MODULE [FILE:LINE]: MESSAGE - for messages by log(), xlog(), xdbg() script funcitons: PROC(PID) LEVEL: