Logging
The TeamSpeak 3 Client Lib offers basic logging functions which write
to the log facilities specified when initializing the client lib with
ts3client_initClientLib()
.
To log a message to the configured logging facilities call
-
unsigned int ts3client_logMessage(const char *logMessage, enum LogLevel severity, const char *channel, uint64 logID)
Log a message to the client log.
- Parameters:
logMessage – utf8 encoded c string of the message to log
severity – the seriousness of the message logged
channel – arbitrary utf8 encoded c string used to group messages. Pass empty string if unused.
logID – a connection handler on which to log the message. Pass 0 if unused.
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
Important
Unless user-defined logging is used, program execution will halt on a
log message with severity LogLevel_CRITICAL
.
User-defined logging
If user-defined logging was enabled when initializing the Client Lib by
passing LogType_USERLOGGING
to the usedLogTypes
parameter of
ts3client_initClientLib()
, the following callback will be called
for every log message that is to be logged. This includes those from the lib
itself, as well as those made by calling ts3client_logMessage()
.
This allows SDK users to customize logging as well as handle criticial errors.
-
struct ClientUIFunctions
Defines available callbacks that you can receive.
Set the members of this struct to a function to call when the specific event happens.
Public Members
-
void (*onUserLoggingMessageEvent)(const char *logmessage, int logLevel, const char *logChannel, uint64 logID, const char *logTime, const char *completeLogString)
called for every log message if the client lib was initialized with user logging
- Param logmessage:
utf8 encoded c string containing the text to log
- Param logLevel:
indicates severity of the message. One of the values from the LogLevel enum
- Param logChannel:
utf8 encoded c string containing the category this message is logged under
- Param logID:
the connection handler this message was logged on
- Param completeLogString:
utf8 encoded c string containing the complete log message containing all other parameters for convenience
-
void (*onUserLoggingMessageEvent)(const char *logmessage, int logLevel, const char *logChannel, uint64 logID, const char *logTime, const char *completeLogString)
Set Logging level
The severity of log messages that are passed to above callback can be configured using
-
unsigned int ts3client_setLogVerbosity(enum LogLevel logVerbosity)
When using custom logging define the severity of log messages above which to call the onUserLoggingMessageEvent for.
- Parameters:
logVerbosity – the verbosity above which to call the logging callback for.
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason