15 lines
9.4 KiB
HTML
15 lines
9.4 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Logging</title><link rel="stylesheet" href="ts3doc.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="TeamSpeak 3 Client SDK Developer Manual"><link rel="up" href="index.html" title="TeamSpeak 3 Client SDK Developer Manual"><link rel="prev" href="ar01s11.html" title="Error handling"><link rel="next" href="ar01s13.html" title="Using playback and capture modes and devices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><img id="logo" src="images/logo.png"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Logging</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s11.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s13.html"><img src="images/next.png" alt="Next"></a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="logging"></a>Logging</h2></div></div></div><p>The TeamSpeak 3 Client Lib offers basic logging functions:
|
||
<a class="indexterm" name="idm44835434854160"></a>
|
||
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">unsigned int <b class="fsfunc">ts3client_logMessage</b>(</code></td><td><var class="pdparam">logMessage</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">severity</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">channel</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">logID</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>const char* <var class="pdparam">logMessage</var></code>;<br><code>LogLevel <var class="pdparam">severity</var></code>;<br><code>const char* <var class="pdparam">channel</var></code>;<br><code>uint64 <var class="pdparam">logID</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
|
||
<a class="indexterm" name="idm44835434849328"></a></p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>logMessage</code></em></p><p>Text written to log.</p></li><li><p><em class="parameter"><code>severity</code></em></p><p>The level of the message, warning or error. Defined by the enum <span class="structname">LogLevel</span><a class="indexterm" name="idm44835434844928"></a> in <code class="filename">clientlib_publicdefinitions.h</code>:</p><a name="loglevelenum"></a><a class="indexterm" name="idm44835434842704"></a><pre class="programlisting">enum LogLevel {
|
||
LogLevel_CRITICAL = 0, //these messages stop the program
|
||
LogLevel_ERROR, //everything that is really bad, but not so bad we need to shut down
|
||
LogLevel_WARNING, //everything that *might* be bad
|
||
LogLevel_DEBUG, //output that might help find a problem
|
||
LogLevel_INFO, //informational output, like "starting database version x.y.z"
|
||
LogLevel_DEVEL //developer only output (will not be displayed in release mode)
|
||
};</pre></li><li><p><em class="parameter"><code>channel</code></em></p><p>Custom text to categorize the message channel (i.e. "Client", "Sound").</p><p>Pass an empty string if unused.</p></li><li><p><em class="parameter"><code>logID</code></em></p><p>Server connection handler ID to identify the current server connection when using multiple connections.</p><p>Pass 0 if unused.</p></li></ul></div><p>All strings need to be encoded in UTF-8 format.</p><p>Returns <em class="structfield"><code>ERROR_ok</code></em> on success, otherwise an error code as defined in <code class="filename">public_errors.h</code>.</p><p>Log messages can be printed to stdout, logged to a file <code class="filename">logs/ts3client_[date]__[time].log</code> and sent to user-defined callbacks. The log output behaviour is defined when initialzing the client library with <a class="link" href="ar01s05.html" title="Initializing"><code class="function">ts3client_initClientLib</code></a>.</p><p>Unless user-defined logging is used, program execution will halt on a log message with severity <em class="structfield"><code>LogLevel_CRITICAL</code></em>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="userlogging"></a>User-defined logging</h3></div></div></div><p>If user-defined logging was enabled when initialzing the Client Lib by passing <em class="structfield"><code>LogType_USERLOGGING</code></em> to the <em class="parameter"><code>usedLogTypes</code></em> parameter of <a class="link" href="ar01s05.html" title="Initializing"><code class="function">ts3client_initClientLib</code></a>, log messages will be sent to the following callback, which allows user customizable logging and handling or critical errors:</p><a class="indexterm" name="idm44835434828320"></a><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">onUserLoggingMessageEvent</b>(</code></td><td><var class="pdparam">logMessage</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">logLevel</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">logChannel</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">logID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">logTime</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">completeLogString</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>const char* <var class="pdparam">logMessage</var></code>;<br><code>int <var class="pdparam">logLevel</var></code>;<br><code>const char* <var class="pdparam">logChannel</var></code>;<br><code>uint64 <var class="pdparam">logID</var></code>;<br><code>const char* <var class="pdparam">logTime</var></code>;<br><code>const char* <var class="pdparam">completeLogString</var></code>;</div><div class="funcprototype-spacer"> </div></div><a class="indexterm" name="idm44835434821776"></a><p>Most callback parameters reflect the arguments passed to the <code class="function">logMessage</code> function.</p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>logMessage</code></em></p><p>Actual log message text.</p></li><li><p><em class="parameter"><code>logLevel</code></em></p><p>Severity of log message, defined by the enum <a class="link" href="ar01s12.html#loglevelenum"><span class="structname">LogLevel</span></a>. Note that only log messages of a level higher than the one configured with <code class="function">ts3client_setLogVerbosity</code> will appear.</p></li><li><p><em class="parameter"><code>logChannel</code></em></p><p>Optional custom text to categorize the message channel.</p></li><li><p><em class="parameter"><code>logID</code></em></p><p>Server connection handler ID identifying the current server connection when using multiple connections.</p></li><li><p><em class="parameter"><code>logTime</code></em></p><p>String with date and time when the log message occured.</p></li><li><p><em class="parameter"><code>completeLogString</code></em></p><p>Provides a verbose log message including all previous parameters for convinience.</p></li></ul></div><div class="literallayout"><p><br>
|
||
</p></div><p>The severity of log messages that are passed to above callback can be configured with:
|
||
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">unsigned int <b class="fsfunc">ts3client_setLogVerbosity</b>(</code></td><td><var class="pdparam">logVerbosity</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>enum LogLevel <var class="pdparam">logVerbosity</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
|
||
<a class="indexterm" name="idm44835434805376"></a></p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>logVerbosity</code></em></p><p>Only messages with a log level equal or higher than <em class="parameter"><code>logVerbosity</code></em> will be sent to the callback. The default value is <em class="structfield"><code>LogLevel_DEVEL</code></em>.</p><p>For example, after calling </p><pre class="programlisting">ts3client_setLogVerbosity(LogLevel_ERROR);</pre><p> only log messages of level <em class="structfield"><code>LogLevel_ERROR</code></em> and <em class="structfield"><code>LogLevel_CRITICAL</code></em> will be passed to <code class="function">onUserLoggingMessageEvent</code>.</p></li></ul></div><p>Returns <em class="structfield"><code>ERROR_ok</code></em> on success, otherwise an error code as defined in <code class="filename">public_errors.h</code>.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s11.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s13.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">Error handling </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> Using playback and capture modes and devices</td></tr></table></div></body></html>
|