The TeamSpeak 3 Client Lib offers basic logging functions:

unsigned int ts3client_logMessage(logMessage,  
const char* logMessage;
LogLevel severity;
const char* channel;
uint64 logID;

All strings need to be encoded in UTF-8 format.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

Log messages can be printed to stdout, logged to a file logs/ts3client_[date]__[time].log and sent to user-defined callbacks. The log output behaviour is defined when initialzing the client library with ts3client_initClientLib.

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 initialzing the Client Lib by passing LogType_USERLOGGING to the usedLogTypes parameter of ts3client_initClientLib, log messages will be sent to the following callback, which allows user customizable logging and handling or critical errors:

void onUserLoggingMessageEvent(logMessage,  
const char* logMessage;
int logLevel;
const char* logChannel;
uint64 logID;
const char* logTime;
const char* completeLogString;

Most callback parameters reflect the arguments passed to the logMessage function.

  • logMessage

    Actual log message text.

  • logLevel

    Severity of log message, defined by the enum LogLevel. Note that only log messages of a level higher than the one configured with ts3client_setLogVerbosity will appear.

  • logChannel

    Optional custom text to categorize the message channel.

  • logID

    Server connection handler ID identifying the current server connection when using multiple connections.

  • logTime

    String with date and time when the log message occured.

  • completeLogString

    Provides a verbose log message including all previous parameters for convinience.

The severity of log messages that are passed to above callback can be configured with:

unsigned int ts3client_setLogVerbosity(logVerbosity); 
enum LogLevel logVerbosity;

  • logVerbosity

    Only messages with a log level equal or higher than logVerbosity will be sent to the callback. The default value is LogLevel_DEVEL.

    For example, after calling


    only log messages of level LogLevel_ERROR and LogLevel_CRITICAL will be passed to onUserLoggingMessageEvent.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.