File: xlog_user.sgml

package info (click to toggle)
openser 1.1.0-9etch1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,828 kB
  • ctags: 11,809
  • sloc: ansic: 120,528; sh: 5,249; yacc: 1,716; makefile: 1,261; php: 656; perl: 205; sql: 190
file content (242 lines) | stat: -rw-r--r-- 5,500 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!-- Module User's Guide -->

<chapter>
	<chapterinfo>
	<revhistory>
		<revision>
		<revnumber>$Revision: 1.6 $</revnumber>
		<date>$Date: 2005/11/28 13:39:19 $</date>
		</revision>
	</revhistory>
	</chapterinfo>
	<title>User's Guide</title>
	
	<section>
	<title>Overview</title>
	<para>
		This module provides the possibility to print user formatted log or
		debug messages from &ser; scripts, similar to printf function but now
		a specifier is replaced with a part of the &sip; request or other
		variables from system.
		<xref linkend="sec-implemented-specifiers"> shows what can be printed
		out.
	</para>
	</section>
	<section id="sec-implemented-specifiers">
	<title>Implemented Specifiers</title>
	<para>
	The specifiers have been replaced by pseudo-variables which are
	now part of &ser; core and are used by other modules as well (e.g., avpops
	in the function avp_printf())
	</para>
	<para>
	The most important changes are:
	</para>
	<itemizedlist>
		<listitem>
		<para>
		- '%' has been replaced by '$'
		</para>
		</listitem>
		<listitem>
		<para>
		- to print a header, use now $hdr(header_name[index]) instead of
		%{header_name[index]}
		</para>
		</listitem>
		<listitem>
		<para>
		- 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]}
		</para>
		</listitem>
	</itemizedlist>
	<para>
	The full list of available pseudo-variables in &ser; is availabe at:
	<ulink url="http://openser.org/docs/pseudo-variables-1.1.x.html">
	http://openser.org/docs/pseudo-variables-1.1.x.html</ulink>
	</para>
	</section>
	<section>
	<title>Dependencies</title>
	<section>
		<title>&ser; Modules</title>
		<para>
		The following modules must be loaded before this module:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>No dependencies on other &ser; modules</emphasis>.
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	<section>
		<title>External Libraries or Applications</title>
		<para>
		The following libraries or applications must be installed before running
		&ser; with this module loaded:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>None</emphasis>.
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	</section>
	<section>
	<title>Exported Parameters</title>
	<section>
		<title><varname>buf_size</varname> (integer)</title>
		<para>
		Maximum size of the log message.
		</para>
		<para>
		<emphasis>
			Default value is 4096.
		</emphasis>
		</para>
		<example>
		<title>Set <varname>buf_size</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("xlog", "buf_size", 8192)
...
</programlisting>
		</example>
	</section>
	<section>
		<title><varname>force_color</varname> (integer)</title>
		<para>
		When set to 1, forces color printing even if log_stderror=0.
		</para>
		<para>
		<emphasis>
			Default value is 0.
		</emphasis>
		</para>
		<example>
		<title>Set <varname>force_color</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("xlog", "force_color", 0)
...
</programlisting>
		</example>
	</section>
	</section>
	<section>
	<title>Exported Functions</title>
	<section>
		<title>
		<function moreinfo="none">xlog([level,] format)</function>
		</title>
		<para>
		Print a formated message using LOG function.
		</para>
		<para>Meaning of the parameters is as follows:</para>
		<itemizedlist>
		<listitem>
			<para><emphasis>level</emphasis> - The level that will be used in LOG function. It can be:
			</para>
			<itemizedlist>
			<listitem>
				<para>
				L_ALERT
				</para>
			</listitem>
			<listitem>
				<para>
				L_CRIT
				</para>
			</listitem>
			<listitem>
				<para>
				L_ERR
				</para>
			</listitem>
			<listitem>
				<para>
				L_WARN
				</para>
			</listitem>
			<listitem>
				<para>
				L_NOTICE
				</para>
			</listitem>
			<listitem>
				<para>
				L_INFO
				</para>
			</listitem>
			<listitem>
				<para>
				L_DBG
				</para>
			</listitem>
			</itemizedlist>
			<para>
			What really matters is the third letter of the value.
			</para>
			<para>
			If this parameter is missing, the implicit log level is 'L_ERR'.
			</para>
		</listitem>
		<listitem>
			<para><emphasis>format</emphasis> - The formatted string to be printed. 
			</para>
		</listitem>
		</itemizedlist>
		<para>
		This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE.
		</para>
		<example>
		<title><function>xlog</function> usage</title>
		<programlisting format="linespecific">
...
xlog("L_ERR", "time [$Tf] method <$rm> r-uri <$ru> 2nd via <$hdr(via[1])>\n");
...
</programlisting>
		</example>
	</section>

	<section>
		<title>
		<function moreinfo="none">xdbg(format)</function>
		</title>
		<para>
		Print a formatted message using DBG function.
		</para>
		<para>Meaning of the parameters is as follows:</para>
		<itemizedlist>
		<listitem>
			<para><emphasis>format</emphasis> - The formatted string to be printed.
			</para>
		</listitem>
		</itemizedlist>
		<para>
		This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE.
		</para>

		<example>
		<title><function>xdbg</function> usage</title>
		<programlisting format="linespecific">
...
xdbg("time $Cbx[$Tf]$Cxx method <$rm> r-uri <$ru>\n");
...
</programlisting>
		</example>
	</section>
	</section>
</chapter>

<!-- Keep this element at the end of the file
Local Variables:
sgml-parent-document: ("xlog.sgml" "Book" "chapter")
End:
-->