xlog Module
Elena-Ramona Modroiu
rosdev.ro
Edited by
Elena-Ramona Modroiu
Copyright � 2003 FhG FOKUS
Copyright � 2008-2010 Elena-Ramona Modroiu
__________________________________________________________________
Table of Contents
1. Admin Guide
1. Overview
2. Implemented Specifiers
3. Dependencies
3.1. Kamailio Modules
3.2. External Libraries or Applications
4. Parameters
4.1. buf_size (integer)
4.2. force_color (integer)
4.3. long_format (integer)
4.4. prefix (str)
4.5. log_facility (string)
4.6. log_colors (string)
4.7. methods_filter (int)
5. Functions
5.1. xlog([ [facility,] level,] format)
5.2. xdbg(format)
5.3. xlogl([ [facility,] level,] format)
5.4. xdbgl(format)
5.5. xlogm(level, format)
List of Examples
1.1. Set buf_size parameter
1.2. Set force_color parameter
1.3. Set long_format parameter
1.4. Set prefix parameter
1.5. log_facility example
1.6. log_colors example
1.7. Set methods_filter parameter
1.8. xlog usage
1.9. xdbg usage
Chapter 1. Admin Guide
Table of Contents
1. Overview
2. Implemented Specifiers
3. Dependencies
3.1. Kamailio Modules
3.2. External Libraries or Applications
4. Parameters
4.1. buf_size (integer)
4.2. force_color (integer)
4.3. long_format (integer)
4.4. prefix (str)
4.5. log_facility (string)
4.6. log_colors (string)
4.7. methods_filter (int)
5. Functions
5.1. xlog([ [facility,] level,] format)
5.2. xdbg(format)
5.3. xlogl([ [facility,] level,] format)
5.4. xdbgl(format)
5.5. xlogm(level, format)
1. Overview
This module provides the possibility to print user formatted log or
debug messages from Kamailio scripts, similar to the printf function. A
C-style printf specifier is replaced with a part of the SIP request or
other variables from system.
2. Implemented Specifiers
In the xlog function, you use pseudo-variables, that are a part of
Kamailio core and are used by other modules as well (e.g., avpops in
the function avp_printf())
The most important changes from earlier versions of Kamailio are:
* - '%' has been replaced by '$'
* - to print a header, use $hdr(header_name[index]) instead of
%{header_name[index]}
* - to print an AVP, use now $avp([si]:avp_id[index]) instead of
%{[si]:avp_id[index]} or $avp([$avp_alias[index]) instead of
%{[$avp_alias[index]}
The full list of available pseudo-variables in Kamailio is available
at: http://kamailio.org/wiki/
3. Dependencies
3.1. Kamailio Modules
3.2. External Libraries or Applications
3.1. Kamailio Modules
The following modules must be loaded before this module:
* No dependencies on other Kamailio modules. Note that many modules
publish pseudovariables that you can use in this module. The core
module for this is the pv module.
3.2. External Libraries or Applications
The following libraries or applications must be installed before
running Kamailio with this module loaded:
* None.
4. Parameters
4.1. buf_size (integer)
4.2. force_color (integer)
4.3. long_format (integer)
4.4. prefix (str)
4.5. log_facility (string)
4.6. log_colors (string)
4.7. methods_filter (int)
4.1. buf_size (integer)
Maximum size of the log message.
Default value is 4096.
Example 1.1. Set buf_size parameter
...
modparam("xlog", "buf_size", 8192)
...
4.2. force_color (integer)
When set to 1, forces color codes in log messages even if log_stderror
is set to 0.
Default value is 0.
Example 1.2. Set force_color parameter
...
modparam("xlog", "force_color", 0)
...
4.3. long_format (integer)
When set to 1, outputs the configuration file name in xlogl() and
xdbgl() before the line number.
Default value is 0.
Example 1.3. Set long_format parameter
...
modparam("xlog", "long_format", 1)
...
4.4. prefix (str)
Prefix to be output before the log message.
Default value is "