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 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Common debug support</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="telepathy-glib API Reference Manual">
<link rel="up" href="ch-utilities.html" title="Utilities">
<link rel="prev" href="telepathy-glib-gnio-util.html" title="GNIO Utilities">
<link rel="next" href="telepathy-glib-debug-sender.html" title="TpDebugSender">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="telepathy-glib-gnio-util.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">telepathy-glib API Reference Manual</th>
<td><a accesskey="n" href="telepathy-glib-debug-sender.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#telepathy-glib-debug.synopsis" class="shortcut">Top</a>
|
<a href="#telepathy-glib-debug.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="telepathy-glib-debug"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="telepathy-glib-debug.top_of_page"></a>Common debug support</span></h2>
<p>Common debug support — API to activate debugging messages from telepathy-glib</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="telepathy-glib-debug.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <telepathy-glib/telepathy-glib.h>
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-set-flags" title="tp_debug_set_flags ()">tp_debug_set_flags</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *flags_string</code></em>);
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-set-persistent" title="tp_debug_set_persistent ()">tp_debug_set_persistent</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> persistent</code></em>);
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-divert-messages" title="tp_debug_divert_messages ()">tp_debug_divert_messages</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>);
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-timestamped-log-handler" title="tp_debug_timestamped_log_handler ()">tp_debug_timestamped_log_handler</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *message</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ignored</code></em>);
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-set-flags-from-string" title="tp_debug_set_flags_from_string ()">tp_debug_set_flags_from_string</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *flags_string</code></em>);
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-set-flags-from-env" title="tp_debug_set_flags_from_env ()">tp_debug_set_flags_from_env</a> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *var</code></em>);
<span class="returnvalue">void</span> <a class="link" href="telepathy-glib-debug.html#tp-debug-set-all-flags" title="tp_debug_set_all_flags ()">tp_debug_set_all_flags</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
</pre>
</div>
<div class="refsect1">
<a name="telepathy-glib-debug.description"></a><h2>Description</h2>
<p>
telepathy-glib has an internal mechanism for debug messages and filtering.
Connection managers written with telepathy-glib are expected to connect
this to their own debugging mechanisms: when the CM's debugging mechanism
is activated, it should call <a class="link" href="telepathy-glib-debug.html#tp-debug-set-flags" title="tp_debug_set_flags ()"><code class="function">tp_debug_set_flags()</code></a> and/or
<a class="link" href="telepathy-glib-debug.html#tp-debug-set-persistent" title="tp_debug_set_persistent ()"><code class="function">tp_debug_set_persistent()</code></a>.
</p>
<p>
The supported debug-mode keywords and the debug messages that they enable
are subject to change, but currently include:
</p>
<p>
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<code class="literal">misc</code> - low-level utility code</li>
<li class="listitem">
<code class="literal">manager</code> -
<a class="link" href="telepathy-glib-connection-manager.html#TpConnectionManager"><span class="type">TpConnectionManager</span></a> (client)</li>
<li class="listitem">
<code class="literal">connection</code> - <a class="link" href="TpBaseConnection.html" title="TpBaseConnection"><span class="type">TpBaseConnection</span></a> (service)
and <a class="link" href="telepathy-glib-connection.html#TpConnection"><span class="type">TpConnection</span></a> (client)</li>
<li class="listitem">
<code class="literal">contacts</code> - <a class="link" href="telepathy-glib-contact.html#TpContact"><span class="type">TpContact</span></a> objects
(client)</li>
<li class="listitem">
<code class="literal">channel</code> - <a class="link" href="telepathy-glib-channel.html#TpChannel"><span class="type">TpChannel</span></a> (client)</li>
<li class="listitem">
<code class="literal">im</code> - (text) instant messaging
(service)</li>
<li class="listitem">
<code class="literal">properties</code> -
<a class="link" href="telepathy-glib-dbus-properties-mixin.html" title="TpDBusPropertiesMixin">TpDBusPropertiesMixin</a> and <a class="link" href="telepathy-glib-TpPropertiesMixin.html#TpPropertiesMixin" title="struct TpPropertiesMixin"><span class="type">TpPropertiesMixin</span></a> (service)</li>
<li class="listitem">
<code class="literal">params</code> - connection manager parameters
(service)</li>
<li class="listitem">
<code class="literal">handles</code> - handle reference tracking tracking
in <a class="link" href="TpBaseConnection.html" title="TpBaseConnection"><span class="type">TpBaseConnection</span></a> (service) and <a class="link" href="telepathy-glib-connection.html#TpConnection"><span class="type">TpConnection</span></a> (client)</li>
<li class="listitem">
<code class="literal">accounts</code> - the <a class="link" href="telepathy-glib-account-manager.html#TpAccountManager"><span class="type">TpAccountManager</span></a> and
<a class="link" href="telepathy-glib-account.html#TpAccount"><span class="type">TpAccount</span></a> objects (client)</li>
<li class="listitem">
<code class="literal">contact-lists</code> - the <a class="link" href="telepathy-glib-base-contact-list.html#TpBaseContactList"><span class="type">TpBaseContactList</span></a>
(service)</li>
<li class="listitem">
<code class="literal">debugger</code> - <a class="link" href="TpDebugClient.html" title="TpDebugClient"><span class="type">TpDebugClient</span></a> objects</li>
<li class="listitem">
<code class="literal">tls</code> - <a class="link" href="TpTLSCertificate.html" title="TpTLSCertificate"><span class="type">TpTLSCertificate</span></a> objects
(client)</li>
<li class="listitem">
<code class="literal">all</code> - all of the above</li>
</ul></div>
<p>
</p>
</div>
<div class="refsect1">
<a name="telepathy-glib-debug.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="tp-debug-set-flags"></a><h3>tp_debug_set_flags ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_set_flags (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *flags_string</code></em>);</pre>
<p>
Set the debug flags indicated by <em class="parameter"><code>flags_string</code></em>, in addition to any already
set.
</p>
<p>
The parsing matches that of <a href="http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-parse-debug-string"><code class="function">g_parse_debug_string()</code></a>.
</p>
<p>
If telepathy-glib was compiled with --disable-debug (not recommended),
this function has no practical effect, since the debug messages it would
enable were removed at compile time.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>flags_string</code></em> :</span></p></td>
<td>The flags to set, comma-separated. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> or empty,
no additional flags are set.</td>
</tr></tbody>
</table></div>
<p class="since">Since 0.6.1</p>
</div>
<hr>
<div class="refsect2">
<a name="tp-debug-set-persistent"></a><h3>tp_debug_set_persistent ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_set_persistent (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> persistent</code></em>);</pre>
<p>
Used to enable persistent operation of the connection manager process for
debugging purposes.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>persistent</code></em> :</span></p></td>
<td>TRUE prevents the connection manager mainloop from exiting,
FALSE enables exiting if there are no connections
(the default behavior).</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="tp-debug-divert-messages"></a><h3>tp_debug_divert_messages ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_divert_messages (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>);</pre>
<p>
Open the given file for writing and duplicate its file descriptor to
be used for stdout and stderr. This has the effect of closing the previous
stdout and stderr, and sending all messages that would have gone there
to the given file instead.
</p>
<p>
By default the file is truncated and hence overwritten each time the
process is executed.
Since version 0.7.14, if the filename is prefixed with '+' then the
file is not truncated and output is added at the end of the file.
</p>
<p>
Passing <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to this function is guaranteed to have no effect. This is
so you can call it with the recommended usage
<code class="literal">tp_debug_divert_messages (g_getenv ("MYAPP_LOGFILE"))</code>
and it won't do anything if the environment variable is not set.
</p>
<p>
This function still works if telepathy-glib was compiled without debug
support.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td>A file to which to divert stdout and stderr, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
do nothing</td>
</tr></tbody>
</table></div>
<p class="since">Since 0.7.1</p>
</div>
<hr>
<div class="refsect2">
<a name="tp-debug-timestamped-log-handler"></a><h3>tp_debug_timestamped_log_handler ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_timestamped_log_handler (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *message</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> ignored</code></em>);</pre>
<p>
A <a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#GLogFunc"><span class="type">GLogFunc</span></a> that prepends the UTC time (currently in ISO 8601 format,
with microsecond resolution) to the message, then calls
g_log_default_handler.
</p>
<p>
Intended usage is:
</p>
<p>
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-getenv">g_getenv</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"MYPROG_TIMING"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
<span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-log-set-default-handler">g_log_set_default_handler</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="telepathy-glib-debug.html#tp-debug-timestamped-log-handler">tp_debug_timestamped_log_handler</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
</p>
<p>
If telepathy-glib was compiled with --disable-debug (not recommended),
this function is equivalent to <a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-log-default-handler"><code class="function">g_log_default_handler()</code></a>.
</p>
<p>
Changed in 0.9.0: timestamps are now printed in UTC, in
RFC-3339 format. Previously, they were printed in local time, in a
format similar to RFC-3339.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>log_domain</code></em> :</span></p></td>
<td>the message's log domain</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>log_level</code></em> :</span></p></td>
<td>the log level of the message</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>the message to process</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ignored</code></em> :</span></p></td>
<td>not used</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 0.7.1</p>
</div>
<hr>
<div class="refsect2">
<a name="tp-debug-set-flags-from-string"></a><h3>tp_debug_set_flags_from_string ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_set_flags_from_string (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *flags_string</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">tp_debug_set_flags_from_string</code> is deprecated and should not be used in newly-written code. since 0.6.1. Use <a class="link" href="telepathy-glib-debug.html#tp-debug-set-flags" title="tp_debug_set_flags ()"><code class="function">tp_debug_set_flags()</code></a> and
<a class="link" href="telepathy-glib-debug.html#tp-debug-set-persistent" title="tp_debug_set_persistent ()"><code class="function">tp_debug_set_persistent()</code></a> instead</p>
</div>
<p>
Set the debug flags indicated by <em class="parameter"><code>flags_string</code></em>, in addition to any already
set. Unlike <a class="link" href="telepathy-glib-debug.html#tp-debug-set-flags" title="tp_debug_set_flags ()"><code class="function">tp_debug_set_flags()</code></a>, this enables persistence like
<a class="link" href="telepathy-glib-debug.html#tp-debug-set-persistent" title="tp_debug_set_persistent ()"><code class="function">tp_debug_set_persistent()</code></a> if the "persist" flag is present or the string
is "all" - this turns out to be unhelpful, as persistence should be
orthogonal.
</p>
<p>
The parsing matches that of <a href="http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-parse-debug-string"><code class="function">g_parse_debug_string()</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>flags_string</code></em> :</span></p></td>
<td>The flags to set, comma-separated. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> or empty,
no additional flags are set.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="tp-debug-set-flags-from-env"></a><h3>tp_debug_set_flags_from_env ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_set_flags_from_env (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *var</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">tp_debug_set_flags_from_env</code> is deprecated and should not be used in newly-written code. since 0.6.1. Use tp_debug_set_flags(g_getenv(...)) and
<a class="link" href="telepathy-glib-debug.html#tp-debug-set-persistent" title="tp_debug_set_persistent ()"><code class="function">tp_debug_set_persistent()</code></a> instead</p>
</div>
<p>
Equivalent to
<code class="literal">tp_debug_set_flags_from_string (g_getenv (var))</code>,
and has the same problem with persistence being included in "all".
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>var</code></em> :</span></p></td>
<td>The name of the environment variable to parse</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="tp-debug-set-all-flags"></a><h3>tp_debug_set_all_flags ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> tp_debug_set_all_flags (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">tp_debug_set_all_flags</code> is deprecated and should not be used in newly-written code. since 0.6.1. Use tp_debug_set_flags ("all") and
<a class="link" href="telepathy-glib-debug.html#tp-debug-set-persistent" title="tp_debug_set_persistent ()"><code class="function">tp_debug_set_persistent()</code></a> instead.</p>
</div>
<p>
Activate all possible debug modes. This also activates persistent mode,
which should have been orthogonal.
</p>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.19</div>
</body>
</html>
|