MillicastSDK 2.0.0
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
millicast::Logger Class Reference

#include <mc_logging.h>

Public Types

enum class  LogComponent { SDK , WEBRTC , WEBSOCKET }
 The LogComponent enum describes which components are possible to receive logs from in the log callback. More...
 

Static Public Member Functions

static MILLICAST_API void set_logger (std::function< void(const std::string &component, const std::string &msg, LogLevel)> f, std::vector< Logger::LogComponent > &&components, bool force_stderr_log=false)
 Set the object that will receive the logs from the SDK.
 
static MILLICAST_API void log (const std::string &msg, LogLevel lvl)
 Send a log to the callback logger.
 
static MILLICAST_API void log_version ()
 Log the version of the millicast SDK.
 
static MILLICAST_API std::string get_version ()
 Get the version of the SDK as a std string.
 
static MILLICAST_API void set_log_levels (LogLevel sdk, LogLevel webrtc=LogLevel::MC_OFF, LogLevel websocket=LogLevel::MC_OFF)
 Set log levels for the core SDK, webrtc and websocket.
 
static MILLICAST_API std::string get_webrtc_version ()
 

Member Enumeration Documentation

◆ LogComponent

The LogComponent enum describes which components are possible to receive logs from in the log callback.

Enumerator
SDK 
WEBRTC 
WEBSOCKET 

Member Function Documentation

◆ get_version()

static MILLICAST_API std::string millicast::Logger::get_version ( )
static

Get the version of the SDK as a std string.

Returns
The version of the SDK

◆ get_webrtc_version()

static MILLICAST_API std::string millicast::Logger::get_webrtc_version ( )
static

◆ log()

static MILLICAST_API void millicast::Logger::log ( const std::string &  msg,
LogLevel  lvl 
)
static

Send a log to the callback logger.

Parameters
msgThe log message
lvlThe severity level

◆ log_version()

static MILLICAST_API void millicast::Logger::log_version ( )
static

Log the version of the millicast SDK.

◆ set_log_levels()

static MILLICAST_API void millicast::Logger::set_log_levels ( LogLevel  sdk,
LogLevel  webrtc = LogLevel::MC_OFF,
LogLevel  websocket = LogLevel::MC_OFF 
)
static

Set log levels for the core SDK, webrtc and websocket.

Note: setting log levels is not atomic, and some log messages may be dropped. It is recommended to not modify the log levels while the client is connected.

◆ set_logger()

static MILLICAST_API void millicast::Logger::set_logger ( std::function< void(const std::string &component, const std::string &msg, LogLevel)>  f,
std::vector< Logger::LogComponent > &&  components,
bool  force_stderr_log = false 
)
static

Set the object that will receive the logs from the SDK.

Note
When this object is set, it will disable the automatic logging to stderr that happens on desktop platforms to avoid double logging. If you would like to keep the logs to stderr and in the callback set the final boolean parameter to true.
If this API is invoked more than once, the first time that StdErr logs are removed we assume you will not be adding them back. So subsequent calls setting force_stderr_log = true will not do anything if the API has be invoked with the value as false at least once.
Parameters
fThe logger object with first parameter being description of the component the log came from, the second being the message itself and finally the log level.
componentsA vector containing the list of components you would like to receive log callbacks for.
for_stderr_logA boolean which will ensure on desktops that logs are always also printed to stderr even when the log callback is set.

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