Module: sip-router Branch: master Commit: 05eb09c1d7bdada655bd29137e2cfe8d1563e689 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=05eb09c1...
Author: Elena-Ramona Modroiu ramona@rosdev.ro Committer: Elena-Ramona Modroiu ramona@rosdev.ro Date: Tue Jun 9 10:20:51 2009 +0300
xlog(k): readme updated
---
modules_k/xlog/README | 157 +++++++++++++++++++++++-------------- modules_k/xlog/doc/xlog_admin.xml | 19 +++++ 2 files changed, 116 insertions(+), 60 deletions(-)
diff --git a/modules_k/xlog/README b/modules_k/xlog/README index 71aa0f5..f1c7966 100644 --- a/modules_k/xlog/README +++ b/modules_k/xlog/README @@ -17,82 +17,109 @@ Elena-Ramona Modroiu
Copyright � 2008 Elena-Ramona Modroiu Revision History - Revision $Revision$ $Date: 2008-08-06 12:08:33 +0200 - (Mi, 06 Aug 2008) $ - __________________________________________________________ + Revision $Revision$ $Date$ + __________________________________________________________________
Table of Contents
1. Admin Guide
- 1.1. Overview - 1.2. Implemented Specifiers - 1.3. Dependencies + 1. Overview + 2. Implemented Specifiers + 3. Dependencies
- 1.3.1. Kamailio Modules - 1.3.2. External Libraries or Applications + 3.1. Kamailio Modules + 3.2. External Libraries or Applications
- 1.4. Exported Parameters + 4. Exported Parameters
- 1.4.1. buf_size (integer) - 1.4.2. force_color (integer) + 4.1. buf_size (integer) + 4.2. force_color (integer) + 4.3. prefix (str)
- 1.5. Exported Functions + 5. Exported Functions
- 1.5.1. xlog([level,] format) - 1.5.2. xdbg(format) + 5.1. xlog([level,] format) + 5.2. xdbg(format)
List of Examples
1.1. Set buf_size parameter 1.2. Set force_color parameter - 1.3. xlog usage - 1.4. xdbg usage + 1.3. Set prefix parameter + 1.4. xlog usage + 1.5. xdbg usage
Chapter 1. Admin Guide
-1.1. Overview + Table of Contents + + 1. Overview + 2. Implemented Specifiers + 3. Dependencies + + 3.1. Kamailio Modules + 3.2. External Libraries or Applications + + 4. Exported Parameters + + 4.1. buf_size (integer) + 4.2. force_color (integer) + 4.3. prefix (str)
- This module provides the possibility to print user formatted - log or debug messages from Kamailio scripts, similar to printf - function. A C-style printf specifier is replaced with a part of - the SIP request or other variables from system. Section 1.2, - "Implemented Specifiers" shows what can be printed out. + 5. Exported Functions
-1.2. Implemented Specifiers + 5.1. xlog([level,] format) + 5.2. xdbg(format)
- 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()) +1. Overview
- The most important changes from earlier versions of Kamailio - are: + This module provides the possibility to print user formatted log or + debug messages from Kamailio scripts, similar to printf function. A + C-style printf specifier is replaced with a part of the SIP request or + other variables from system. Section 2, "Implemented Specifiers" shows + what can be printed out. + +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 now $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]} + * - to print a header, use now $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/dokuwiki/
- The full list of available pseudo-variables in Kamailio is - available at: http://kamailio.org/dokuwiki/ +3. Dependencies
-1.3. Dependencies + 3.1. Kamailio Modules + 3.2. External Libraries or Applications
-1.3.1. Kamailio Modules +3.1. Kamailio Modules
The following modules must be loaded before this module: * No dependencies on other Kamailio modules.
-1.3.2. External Libraries or Applications +3.2. External Libraries or Applications
- The following libraries or applications must be installed - before running Kamailio with this module loaded: + The following libraries or applications must be installed before + running Kamailio with this module loaded: * None.
-1.4. Exported Parameters +4. Exported Parameters
-1.4.1. buf_size (integer) + 4.1. buf_size (integer) + 4.2. force_color (integer) + 4.3. prefix (str) + +4.1. buf_size (integer)
Maximum size of the log message.
@@ -103,7 +130,7 @@ Chapter 1. Admin Guide modparam("xlog", "buf_size", 8192) ...
-1.4.2. force_color (integer) +4.2. force_color (integer)
When set to 1, forces color printing even if log_stderror=0.
@@ -114,15 +141,28 @@ modparam("xlog", "buf_size", 8192) modparam("xlog", "force_color", 0) ...
-1.5. Exported Functions +4.3. prefix (str) + + Prefix to be printed before the log message. + + Default value is "<script>: ". + + Example 1.3. Set prefix parameter +... +modparam("xlog", "prefix", "-xlog: ") +... + +5. Exported Functions + + 5.1. xlog([level,] format) + 5.2. xdbg(format)
-1.5.1. xlog([level,] format) +5.1. xlog([level,] format)
Print a formated message using LOG function.
Meaning of the parameters are as follows: - * level - The level that will be used in LOG function. It can - be: + * level - The level that will be used in LOG function. It can be: + L_ALERT - log level -3 + L_CRIT - log level -2 + L_ERR - log level -1 @@ -130,23 +170,20 @@ modparam("xlog", "force_color", 0) + L_NOTICE - log level 2 + L_INFO - log level 3 + L_DBG - log level 4 - + $pv - any valid pseudo-variable, that has an integer - value. See above options for valid log levels. - If it is not a pseudo-variable, then what really matters is - the third letter of the value. If the log level is higher - than the "debug" global parameter, the message is not - printed to syslog. - If this parameter is missing, the implicit log level is - 'L_ERR'. + + $pv - any valid pseudo-variable, that has an integer value. + See above options for valid log levels. + If it is not a pseudo-variable, then what really matters is the + third letter of the value. If the log level is higher than the + "debug" global parameter, the message is not printed to syslog. + If this parameter is missing, the implicit log level is 'L_ERR'. * format - The formatted string to be printed.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE.
- Example 1.3. xlog usage + Example 1.4. xlog usage ... -xlog("L_ERR", "time [$Tf] method ($rm) r-uri ($ru) 2nd via ($hdr(via[1]) -)\n"); +xlog("L_ERR", "time [$Tf] method ($rm) r-uri ($ru) 2nd via ($hdr(via[1]))\n"); ... xlog("time [$Tf] method ($rm) r-uri ($ru) 2nd via ($hdr(via[1]))\n"); ... @@ -154,7 +191,7 @@ $var(loglevel) = 2; xlog("$var(loglevel)", "time [$Tf] method ($rm) r-uri ($ru)\n"); ...
-1.5.2. xdbg(format) +5.2. xdbg(format)
Print a formatted message using DBG function.
@@ -164,7 +201,7 @@ xlog("$var(loglevel)", "time [$Tf] method ($rm) r-uri ($ru)\n"); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE.
- Example 1.4. xdbg usage + Example 1.5. xdbg usage ... xdbg("time $Cbx[$Tf]$Cxx method ($rm) r-uri ($ru)\n"); ... diff --git a/modules_k/xlog/doc/xlog_admin.xml b/modules_k/xlog/doc/xlog_admin.xml index 570abc6..0db2da8 100644 --- a/modules_k/xlog/doc/xlog_admin.xml +++ b/modules_k/xlog/doc/xlog_admin.xml @@ -131,6 +131,25 @@ modparam("xlog", "force_color", 0) </programlisting> </example> </section> + <section> + <title><varname>prefix</varname> (str)</title> + <para> + Prefix to be printed before the log message. + </para> + <para> + <emphasis> + Default value is "<script>: ". + </emphasis> + </para> + <example> + <title>Set <varname>prefix</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("xlog", "prefix", "-xlog: ") +... +</programlisting> + </example> + </section> </section> <section> <title>Exported Functions</title>