List of all members | Public Types | Public Class Methods
Log Class Reference

Description

Interface for managing the internal logging of TDLib. By default TDLib writes logs to stderr or an OS specific log and uses a verbosity level of 5. These functions are deprecated since TDLib 1.4.0 in favor of the td::td_api::setLogVerbosityLevel, td::td_api::setLogStream and other synchronous requests for managing the internal TDLib logging.

Public Types

using FatalErrorCallbackPtr = void(*)(const char *error_message)
 

Public Class Methods

static bool set_file_path (std::string file_path)
 
static void set_max_file_size (std::int64_t max_file_size)
 
static void set_verbosity_level (int new_verbosity_level)
 
static void set_fatal_error_callback (FatalErrorCallbackPtr callback)
 

Member Typedef Documentation

◆ FatalErrorCallbackPtr

using FatalErrorCallbackPtr = void (*)(const char *error_message)

A type of callback function that will be called when a fatal error happens.

Parameters
error_messageNull-terminated string with a description of a happened fatal error.

Method Documentation

◆ set_file_path()

static bool set_file_path ( std::string  file_path)
static

Sets the path to the file to where the internal TDLib log will be written. By default TDLib writes logs to stderr or an OS specific log. Use this method to write the log to a file instead.

Deprecated. Use synchronous td::td_api::setLogStream request instead.
Parameters
[in]file_pathPath to a file where the internal TDLib log will be written. Use an empty path to switch back to the default logging behaviour.
Returns
True on success, or false otherwise, i.e. if the file can't be opened for writing.

◆ set_max_file_size()

static void set_max_file_size ( std::int64_t  max_file_size)
static

Sets the maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated. Unused if log is not written to a file. Defaults to 10 MB.

Deprecated. Use synchronous td::td_api::setLogStream request instead.
Parameters
[in]max_file_sizeThe maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated. Should be positive.

◆ set_verbosity_level()

static void set_verbosity_level ( int  new_verbosity_level)
static

Sets the verbosity level of the internal logging of TDLib. By default the TDLib uses a verbosity level of 5 for logging.

Deprecated. Use synchronous td::td_api::setLogVerbosityLevel request instead.
Parameters
[in]new_verbosity_levelNew value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1024 can be used to enable even more logging.

◆ set_fatal_error_callback()

static void set_fatal_error_callback ( FatalErrorCallbackPtr  callback)
static

Sets the callback that will be called when a fatal error happens. None of the TDLib methods can be called from the callback. The TDLib will crash as soon as callback returns. By default the callback is not set.

Deprecated. Use ClientManager::set_log_message_callback instead.
Parameters
[in]callbackCallback that will be called when a fatal error happens. Pass nullptr to remove the callback.

The documentation for this class was generated from the following file: