Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::common::Logger Class Reference

Process-wide logger. More...

#include <logger.hpp>

Public Types

using Sink = std::function<void(LogLevel, std::string_view)>

Static Public Member Functions

static void set_level (LogLevel level) noexcept
static LogLevel level () noexcept
static void set_sink (Sink sink)
 Replaces the output.
static bool enabled (LogLevel level) noexcept
static void log (LogLevel level, std::string_view message) noexcept
static void debug (std::string_view message) noexcept
static void info (std::string_view message) noexcept
static void warn (std::string_view message) noexcept
static void error (std::string_view message) noexcept

Detailed Description

Process-wide logger.

Defaults to Info on stderr, or to the level named by the LOG_LEVEL environment variable (debug, info, warn, error, none).

Member Typedef Documentation

◆ Sink

using binance::common::Logger::Sink = std::function<void(LogLevel, std::string_view)>

Member Function Documentation

◆ set_level()

void binance::common::Logger::set_level ( LogLevel level)
staticnoexcept

◆ level()

LogLevel binance::common::Logger::level ( )
staticnodiscardnoexcept

◆ set_sink()

void binance::common::Logger::set_sink ( Sink sink)
static

Replaces the output.

An empty sink restores stderr. The sink may be called from any thread; exceptions it throws are discarded.

◆ enabled()

bool binance::common::Logger::enabled ( LogLevel level)
inlinestaticnodiscardnoexcept

◆ log()

void binance::common::Logger::log ( LogLevel level,
std::string_view message )
staticnoexcept

◆ debug()

void binance::common::Logger::debug ( std::string_view message)
inlinestaticnoexcept

◆ info()

void binance::common::Logger::info ( std::string_view message)
inlinestaticnoexcept

◆ warn()

void binance::common::Logger::warn ( std::string_view message)
inlinestaticnoexcept

◆ error()

void binance::common::Logger::error ( std::string_view message)
inlinestaticnoexcept