124
121
The decimal IDs are simply counters that uniquely identify objects
125
122
across the lifetime of the <link linkend="SoupLogger"><type>SoupLogger</type></link>. In particular, this can be
126
123
used to identify when multiple messages are sent across the same
127
The request half of the message is logged just before the first
128
byte of the request gets written to the network (from the
129
<link linkend="SoupSession-request-started"><type>"request_started"</type></link> signal), and the response is logged
130
just after the last byte of the response body is read from the
131
network (from the <link linkend="SoupMessage-got-body"><type>"got_body"</type></link> or
132
<link linkend="SoupMessage-got-informational"><type>"got_informational"</type></link> signal). In particular, note that
133
the <link linkend="SoupMessage-got-headers"><type>"got_headers"</type></link> signal, and anything triggered off it
134
(such as <link linkend="SoupSession-authenticate"><type>"authenticate"</type></link>) will be emitted
135
<emphasis>before</emphasis> the response headers are actually
151
158
Describes the level of logging output to provide.</para>
154
160
</para><variablelist role="enum">
155
<varlistentry id="SOUP-LOGGER-LOG-NONE:CAPS" role="constant">
161
<varlistentry id="SOUP-LOGGER-LOG-NONE--CAPS" role="constant">
156
162
<term><literal>SOUP_LOGGER_LOG_NONE</literal></term>
157
163
<listitem><simpara> No logging
158
164
</simpara></listitem>
160
<varlistentry id="SOUP-LOGGER-LOG-MINIMAL:CAPS" role="constant">
166
<varlistentry id="SOUP-LOGGER-LOG-MINIMAL--CAPS" role="constant">
161
167
<term><literal>SOUP_LOGGER_LOG_MINIMAL</literal></term>
162
168
<listitem><simpara> Log the Request-Line or Status-Line and
163
169
the Soup-Debug pseudo-headers
164
170
</simpara></listitem>
166
<varlistentry id="SOUP-LOGGER-LOG-HEADERS:CAPS" role="constant">
172
<varlistentry id="SOUP-LOGGER-LOG-HEADERS--CAPS" role="constant">
167
173
<term><literal>SOUP_LOGGER_LOG_HEADERS</literal></term>
168
174
<listitem><simpara> Log the full request/response headers
169
175
</simpara></listitem>
171
<varlistentry id="SOUP-LOGGER-LOG-BODY:CAPS" role="constant">
177
<varlistentry id="SOUP-LOGGER-LOG-BODY--CAPS" role="constant">
172
178
<term><literal>SOUP_LOGGER_LOG_BODY</literal></term>
173
179
<listitem><simpara> Log the full headers and request/response
177
183
</variablelist></refsect2>
178
184
<refsect2 id="soup-logger-new" role="function">
179
185
<title>soup_logger_new ()</title>
180
<indexterm zone="soup-logger-new"><primary>soup_logger_new</primary></indexterm><programlisting><link linkend="SoupLogger">SoupLogger</link>* soup_logger_new (<link linkend="SoupLoggerLogLevel">SoupLoggerLogLevel</link> level,
186
<indexterm zone="soup-logger-new"><primary sortas="soup_logger_new">soup_logger_new</primary></indexterm><programlisting><link linkend="SoupLogger">SoupLogger</link> * soup_logger_new (<link linkend="SoupLoggerLogLevel">SoupLoggerLogLevel</link> level,
181
187
<link linkend="int">int</link> max_body_size);</programlisting>
183
189
Creates a new <link linkend="SoupLogger"><type>SoupLogger</type></link> with the given debug level. If <parameter>level</parameter> is
184
<link linkend="SOUP-LOGGER-LOG-BODY:CAPS"><literal>SOUP_LOGGER_LOG_BODY</literal></link>, <parameter>max_body_size</parameter> gives the maximum number of
190
<link linkend="SOUP-LOGGER-LOG-BODY--CAPS"><literal>SOUP_LOGGER_LOG_BODY</literal></link>, <parameter>max_body_size</parameter> gives the maximum number of
185
191
bytes of the body that will be logged. (-1 means "no limit".)
189
195
logged, use <link linkend="soup-logger-set-request-filter"><function>soup_logger_set_request_filter()</function></link> and
190
196
<link linkend="soup-logger-set-response-filter"><function>soup_logger_set_response_filter()</function></link>.</para>
193
198
</para><variablelist role="params">
194
<varlistentry><term><parameter>level</parameter> :</term>
199
<varlistentry><term><parameter>level</parameter> :</term>
195
200
<listitem><simpara> the debug level
196
201
</simpara></listitem></varlistentry>
197
<varlistentry><term><parameter>max_body_size</parameter> :</term>
202
<varlistentry><term><parameter>max_body_size</parameter> :</term>
198
203
<listitem><simpara> the maximum body size to output, or -1
199
204
</simpara></listitem></varlistentry>
200
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a new <link linkend="SoupLogger"><type>SoupLogger</type></link>
205
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a new <link linkend="SoupLogger"><type>SoupLogger</type></link>
201
206
</simpara></listitem></varlistentry>
202
207
</variablelist></refsect2>
203
208
<refsect2 id="soup-logger-attach" role="function" condition="deprecated:Use soup_session_add_feature() instead.">
204
209
<title>soup_logger_attach ()</title>
205
<indexterm zone="soup-logger-attach" role="deprecated"><primary>soup_logger_attach</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_attach (<link linkend="SoupLogger">SoupLogger</link> *logger,
210
<indexterm zone="soup-logger-attach" role="deprecated"><primary sortas="soup_logger_attach">soup_logger_attach</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_attach (<link linkend="SoupLogger">SoupLogger</link> *logger,
206
211
<link linkend="SoupSession">SoupSession</link> *session);</programlisting>
207
212
<warning><para><literal>soup_logger_attach</literal> is deprecated and should not be used in newly-written code. Use <link linkend="soup-session-add-feature"><function>soup_session_add_feature()</function></link> instead.</para></warning>
214
219
removed when you call <link linkend="soup-logger-detach"><function>soup_logger_detach()</function></link>, or when the session is
215
220
destroyed.)</para>
218
222
</para><variablelist role="params">
219
<varlistentry><term><parameter>logger</parameter> :</term>
223
<varlistentry><term><parameter>logger</parameter> :</term>
220
224
<listitem><simpara> a <link linkend="SoupLogger"><type>SoupLogger</type></link>
221
225
</simpara></listitem></varlistentry>
222
<varlistentry><term><parameter>session</parameter> :</term>
226
<varlistentry><term><parameter>session</parameter> :</term>
223
227
<listitem><simpara> a <link linkend="SoupSession"><type>SoupSession</type></link>
224
228
</simpara></listitem></varlistentry>
225
229
</variablelist></refsect2>
226
230
<refsect2 id="soup-logger-detach" role="function" condition="deprecated:Use soup_session_remove_feature() instead.">
227
231
<title>soup_logger_detach ()</title>
228
<indexterm zone="soup-logger-detach" role="deprecated"><primary>soup_logger_detach</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_detach (<link linkend="SoupLogger">SoupLogger</link> *logger,
232
<indexterm zone="soup-logger-detach" role="deprecated"><primary sortas="soup_logger_detach">soup_logger_detach</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_detach (<link linkend="SoupLogger">SoupLogger</link> *logger,
229
233
<link linkend="SoupSession">SoupSession</link> *session);</programlisting>
230
234
<warning><para><literal>soup_logger_detach</literal> is deprecated and should not be used in newly-written code. Use <link linkend="soup-session-remove-feature"><function>soup_session_remove_feature()</function></link> instead.</para></warning>
232
236
Stops <parameter>logger</parameter> from watching <parameter>session</parameter>.</para>
235
238
</para><variablelist role="params">
236
<varlistentry><term><parameter>logger</parameter> :</term>
239
<varlistentry><term><parameter>logger</parameter> :</term>
237
240
<listitem><simpara> a <link linkend="SoupLogger"><type>SoupLogger</type></link>
238
241
</simpara></listitem></varlistentry>
239
<varlistentry><term><parameter>session</parameter> :</term>
242
<varlistentry><term><parameter>session</parameter> :</term>
240
243
<listitem><simpara> a <link linkend="SoupSession"><type>SoupSession</type></link>
241
244
</simpara></listitem></varlistentry>
242
245
</variablelist></refsect2>
243
246
<refsect2 id="SoupLoggerFilter" role="function">
244
247
<title>SoupLoggerFilter ()</title>
245
<indexterm zone="SoupLoggerFilter"><primary>SoupLoggerFilter</primary></indexterm><programlisting><link linkend="SoupLoggerLogLevel">SoupLoggerLogLevel</link> (*SoupLoggerFilter) (<link linkend="SoupLogger">SoupLogger</link> *logger,
248
<indexterm zone="SoupLoggerFilter"><primary sortas="SoupLoggerFilter">SoupLoggerFilter</primary></indexterm><programlisting><link linkend="SoupLoggerLogLevel">SoupLoggerLogLevel</link> (*SoupLoggerFilter) (<link linkend="SoupLogger">SoupLogger</link> *logger,
246
249
<link linkend="SoupMessage">SoupMessage</link> *msg,
247
250
<link linkend="gpointer">gpointer</link> user_data);</programlisting>
249
252
The prototype for a logging filter. The filter callback will be
250
253
invoked for each request or response, and should analyze it and
251
254
return a <link linkend="SoupLoggerLogLevel"><type>SoupLoggerLogLevel</type></link> value indicating how much of the
252
message to log. Eg, it might choose between <link linkend="SOUP-LOGGER-LOG-BODY:CAPS"><literal>SOUP_LOGGER_LOG_BODY</literal></link>
253
and <link linkend="SOUP-LOGGER-LOG-HEADERS:CAPS"><literal>SOUP_LOGGER_LOG_HEADERS</literal></link> depending on the Content-Type.</para>
255
message to log. Eg, it might choose between <link linkend="SOUP-LOGGER-LOG-BODY--CAPS"><literal>SOUP_LOGGER_LOG_BODY</literal></link>
256
and <link linkend="SOUP-LOGGER-LOG-HEADERS--CAPS"><literal>SOUP_LOGGER_LOG_HEADERS</literal></link> depending on the Content-Type.</para>
256
258
</para><variablelist role="params">
257
<varlistentry><term><parameter>logger</parameter> :</term>
259
<varlistentry><term><parameter>logger</parameter> :</term>
258
260
<listitem><simpara> the <link linkend="SoupLogger"><type>SoupLogger</type></link>
259
261
</simpara></listitem></varlistentry>
260
<varlistentry><term><parameter>msg</parameter> :</term>
262
<varlistentry><term><parameter>msg</parameter> :</term>
261
263
<listitem><simpara> the message being logged
262
264
</simpara></listitem></varlistentry>
263
<varlistentry><term><parameter>user_data</parameter> :</term>
265
<varlistentry><term><parameter>user_data</parameter> :</term>
264
266
<listitem><simpara> the data passed to <link linkend="soup-logger-set-request-filter"><function>soup_logger_set_request_filter()</function></link>
265
267
or <link linkend="soup-logger-set-response-filter"><function>soup_logger_set_response_filter()</function></link>
266
268
</simpara></listitem></varlistentry>
267
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="SoupLoggerLogLevel"><type>SoupLoggerLogLevel</type></link> value indicating how much of
269
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="SoupLoggerLogLevel"><type>SoupLoggerLogLevel</type></link> value indicating how much of
268
270
the message to log
269
271
</simpara></listitem></varlistentry>
270
272
</variablelist></refsect2>
271
273
<refsect2 id="soup-logger-set-request-filter" role="function">
272
274
<title>soup_logger_set_request_filter ()</title>
273
<indexterm zone="soup-logger-set-request-filter"><primary>soup_logger_set_request_filter</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_set_request_filter (<link linkend="SoupLogger">SoupLogger</link> *logger,
275
<indexterm zone="soup-logger-set-request-filter"><primary sortas="soup_logger_set_request_filter">soup_logger_set_request_filter</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_set_request_filter (<link linkend="SoupLogger">SoupLogger</link> *logger,
274
276
<link linkend="SoupLoggerFilter">SoupLoggerFilter</link> request_filter,
275
277
<link linkend="gpointer">gpointer</link> filter_data,
276
278
<link linkend="GDestroyNotify">GDestroyNotify</link> destroy);</programlisting>
281
283
set a request filter, <parameter>logger</parameter> will just always log requests at the
282
284
level passed to <link linkend="soup-logger-new"><function>soup_logger_new()</function></link>.)</para>
285
286
</para><variablelist role="params">
286
<varlistentry><term><parameter>logger</parameter> :</term>
287
<varlistentry><term><parameter>logger</parameter> :</term>
287
288
<listitem><simpara> a <link linkend="SoupLogger"><type>SoupLogger</type></link>
288
289
</simpara></listitem></varlistentry>
289
<varlistentry><term><parameter>request_filter</parameter> :</term>
290
<varlistentry><term><parameter>request_filter</parameter> :</term>
290
291
<listitem><simpara> the callback for request debugging
291
292
</simpara></listitem></varlistentry>
292
<varlistentry><term><parameter>filter_data</parameter> :</term>
293
<varlistentry><term><parameter>filter_data</parameter> :</term>
293
294
<listitem><simpara> data to pass to the callback
294
295
</simpara></listitem></varlistentry>
295
<varlistentry><term><parameter>destroy</parameter> :</term>
296
<varlistentry><term><parameter>destroy</parameter> :</term>
296
297
<listitem><simpara> a <link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> to free <parameter>filter_data</parameter>
297
298
</simpara></listitem></varlistentry>
298
299
</variablelist></refsect2>
299
300
<refsect2 id="soup-logger-set-response-filter" role="function">
300
301
<title>soup_logger_set_response_filter ()</title>
301
<indexterm zone="soup-logger-set-response-filter"><primary>soup_logger_set_response_filter</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_set_response_filter (<link linkend="SoupLogger">SoupLogger</link> *logger,
302
<indexterm zone="soup-logger-set-response-filter"><primary sortas="soup_logger_set_response_filter">soup_logger_set_response_filter</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_set_response_filter (<link linkend="SoupLogger">SoupLogger</link> *logger,
302
303
<link linkend="SoupLoggerFilter">SoupLoggerFilter</link> response_filter,
303
304
<link linkend="gpointer">gpointer</link> filter_data,
304
305
<link linkend="GDestroyNotify">GDestroyNotify</link> destroy);</programlisting>
309
310
set a response filter, <parameter>logger</parameter> will just always log responses at
310
311
the level passed to <link linkend="soup-logger-new"><function>soup_logger_new()</function></link>.)</para>
313
313
</para><variablelist role="params">
314
<varlistentry><term><parameter>logger</parameter> :</term>
314
<varlistentry><term><parameter>logger</parameter> :</term>
315
315
<listitem><simpara> a <link linkend="SoupLogger"><type>SoupLogger</type></link>
316
316
</simpara></listitem></varlistentry>
317
<varlistentry><term><parameter>response_filter</parameter> :</term>
317
<varlistentry><term><parameter>response_filter</parameter> :</term>
318
318
<listitem><simpara> the callback for response debugging
319
319
</simpara></listitem></varlistentry>
320
<varlistentry><term><parameter>filter_data</parameter> :</term>
320
<varlistentry><term><parameter>filter_data</parameter> :</term>
321
321
<listitem><simpara> data to pass to the callback
322
322
</simpara></listitem></varlistentry>
323
<varlistentry><term><parameter>destroy</parameter> :</term>
323
<varlistentry><term><parameter>destroy</parameter> :</term>
324
324
<listitem><simpara> a <link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> to free <parameter>filter_data</parameter>
325
325
</simpara></listitem></varlistentry>
326
326
</variablelist></refsect2>
327
327
<refsect2 id="SoupLoggerPrinter" role="function">
328
328
<title>SoupLoggerPrinter ()</title>
329
<indexterm zone="SoupLoggerPrinter"><primary>SoupLoggerPrinter</primary></indexterm><programlisting><link linkend="void">void</link> (*SoupLoggerPrinter) (<link linkend="SoupLogger">SoupLogger</link> *logger,
329
<indexterm zone="SoupLoggerPrinter"><primary sortas="SoupLoggerPrinter">SoupLoggerPrinter</primary></indexterm><programlisting><link linkend="void">void</link> (*SoupLoggerPrinter) (<link linkend="SoupLogger">SoupLogger</link> *logger,
330
330
<link linkend="SoupLoggerLogLevel">SoupLoggerLogLevel</link> level,
331
331
<link linkend="char">char</link> direction,
332
332
const <link linkend="char">char</link> *data,
350
350
printf ("%c %s\n", direction, data);
351
351
</programlisting></informalexample></para>
354
353
</para><variablelist role="params">
355
<varlistentry><term><parameter>logger</parameter> :</term>
354
<varlistentry><term><parameter>logger</parameter> :</term>
356
355
<listitem><simpara> the <link linkend="SoupLogger"><type>SoupLogger</type></link>
357
356
</simpara></listitem></varlistentry>
358
<varlistentry><term><parameter>level</parameter> :</term>
357
<varlistentry><term><parameter>level</parameter> :</term>
359
358
<listitem><simpara> the level of the information being printed.
360
359
</simpara></listitem></varlistentry>
361
<varlistentry><term><parameter>direction</parameter> :</term>
360
<varlistentry><term><parameter>direction</parameter> :</term>
362
361
<listitem><simpara> a single-character prefix to <parameter>data</parameter>
363
362
</simpara></listitem></varlistentry>
364
<varlistentry><term><parameter>data</parameter> :</term>
363
<varlistentry><term><parameter>data</parameter> :</term>
365
364
<listitem><simpara> data to print
366
365
</simpara></listitem></varlistentry>
367
<varlistentry><term><parameter>user_data</parameter> :</term>
366
<varlistentry><term><parameter>user_data</parameter> :</term>
368
367
<listitem><simpara> the data passed to <link linkend="soup-logger-set-printer"><function>soup_logger_set_printer()</function></link>
369
368
</simpara></listitem></varlistentry>
370
369
</variablelist></refsect2>
371
370
<refsect2 id="soup-logger-set-printer" role="function">
372
371
<title>soup_logger_set_printer ()</title>
373
<indexterm zone="soup-logger-set-printer"><primary>soup_logger_set_printer</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_set_printer (<link linkend="SoupLogger">SoupLogger</link> *logger,
372
<indexterm zone="soup-logger-set-printer"><primary sortas="soup_logger_set_printer">soup_logger_set_printer</primary></indexterm><programlisting><link linkend="void">void</link> soup_logger_set_printer (<link linkend="SoupLogger">SoupLogger</link> *logger,
374
373
<link linkend="SoupLoggerPrinter">SoupLoggerPrinter</link> printer,
375
374
<link linkend="gpointer">gpointer</link> printer_data,
376
375
<link linkend="GDestroyNotify">GDestroyNotify</link> destroy);</programlisting>
378
377
Sets up an alternate log printing routine, if you don't want
379
378
the log to go to <link linkend="stdout"><literal>stdout</literal></link>.</para>
382
380
</para><variablelist role="params">
383
<varlistentry><term><parameter>logger</parameter> :</term>
381
<varlistentry><term><parameter>logger</parameter> :</term>
384
382
<listitem><simpara> a <link linkend="SoupLogger"><type>SoupLogger</type></link>
385
383
</simpara></listitem></varlistentry>
386
<varlistentry><term><parameter>printer</parameter> :</term>
384
<varlistentry><term><parameter>printer</parameter> :</term>
387
385
<listitem><simpara> the callback for printing logging output
388
386
</simpara></listitem></varlistentry>
389
<varlistentry><term><parameter>printer_data</parameter> :</term>
387
<varlistentry><term><parameter>printer_data</parameter> :</term>
390
388
<listitem><simpara> data to pass to the callback
391
389
</simpara></listitem></varlistentry>
392
<varlistentry><term><parameter>destroy</parameter> :</term>
390
<varlistentry><term><parameter>destroy</parameter> :</term>
393
391
<listitem><simpara> a <link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> to free <parameter>printer_data</parameter>
394
392
</simpara></listitem></varlistentry>
395
393
</variablelist></refsect2>