Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::Logger Class Reference

Level-driven logging class that support printf and C++ stream logging fashions. More...

#include <logger.h>

Collaboration diagram for jami::Logger:
Collaboration graph

Classes

class  Handler
 
struct  Msg
 

Public Member Functions

 Logger ()=delete
 
 Logger (const Logger &)=delete
 
 Logger (int level, const char *file, int line, bool linefeed)
 
 Logger (Logger &&)=default
 
template<typename T >
Loggeroperator<< (const T &value)
 
 ~Logger ()
 

Static Public Member Functions

static bool debugEnabled ()
 
static constexpr int dhtLevel (dht::log::LogLevel level)
 
static std::shared_ptr< dht::log::Logger > dhtLogger ()
 
static void fini ()
 
static Logger log (int level, const char *file, int line, bool linefeed)
 Stream fashion logging.
 
static LIBJAMI_PUBLIC void log (int level, const char *file, int line, bool linefeed, const char *const fmt,...) PRINTF_ATTRIBUTE(5
 Printf fashion logging.
 
static void setConsoleLog (bool enable)
 
static void setDebugMode (bool enable)
 
static void setFileLog (const std::string &path)
 
static void setMonitorLog (bool enable)
 
static void setSysLog (bool enable)
 
static LIBJAMI_PUBLIC void static LIBJAMI_PUBLIC void vlog (int level, const char *file, int line, bool linefeed, const char *fmt, va_list)
 Printf fashion logging (using va_list parameters)
 
static LIBJAMI_PUBLIC void write (int level, const char *file, int line, bool linefeed, std::string &&message)
 
static void writeDht (dht::log::LogLevel level, std::string &&message)
 

Detailed Description

Level-driven logging class that support printf and C++ stream logging fashions.

Definition at line 82 of file logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/4]

jami::Logger::Logger ( int  level,
const char file,
int  line,
bool  linefeed 
)
inline

Definition at line 89 of file logger.h.

◆ Logger() [2/4]

jami::Logger::Logger ( )
delete

◆ Logger() [3/4]

jami::Logger::Logger ( const Logger )
delete

◆ Logger() [4/4]

jami::Logger::Logger ( Logger &&  )
default

◆ ~Logger()

jami::Logger::~Logger ( )
inline

Definition at line 100 of file logger.h.

References log().

Here is the call graph for this function:

Member Function Documentation

◆ debugEnabled()

bool jami::Logger::debugEnabled ( )
static

Definition at line 561 of file logger.cpp.

References jami::debugEnabled_.

◆ dhtLevel()

static constexpr int jami::Logger::dhtLevel ( dht::log::LogLevel  level)
inlinestaticconstexpr

Definition at line 109 of file logger.h.

References jami::emitSignal().

Referenced by writeDht().

Here is the call graph for this function:

◆ dhtLogger()

static std::shared_ptr< dht::log::Logger > jami::Logger::dhtLogger ( )
inlinestatic

Definition at line 127 of file logger.h.

◆ fini()

void jami::Logger::fini ( )
static

Definition at line 600 of file logger.cpp.

References jami::FileLog::instance(), and jami::FileLog::setFile().

Here is the call graph for this function:

◆ log() [1/2]

static Logger jami::Logger::log ( int  level,
const char file,
int  line,
bool  linefeed 
)
inlinestatic

Stream fashion logging.

Example: JAMI_DBG() << "Hello, World!"

Definition at line 161 of file logger.h.

References jami::emitSignal().

Here is the call graph for this function:

◆ log() [2/2]

LIBJAMI_PUBLIC void jami::Logger::log ( int  level,
const char file,
int  line,
bool  linefeed,
const char *const  fmt,
  ... 
)
static

Printf fashion logging.

Example: JAMI_DBG("%s", "Hello, World!")

Definition at line 532 of file logger.cpp.

References jami::emitSignal(), and vlog().

Referenced by ~Logger().

Here is the call graph for this function:

◆ operator<<()

template<typename T >
Logger & jami::Logger::operator<< ( const T value)
inline

Definition at line 103 of file logger.h.

References jami::emitSignal().

Here is the call graph for this function:

◆ setConsoleLog()

void jami::Logger::setConsoleLog ( bool  enable)
static

Definition at line 354 of file logger.cpp.

References jami::emitSignal(), jami::Logger::Handler::enable(), and jami::ConsoleLog::instance().

Here is the call graph for this function:

◆ setDebugMode()

void jami::Logger::setDebugMode ( bool  enable)
static

Definition at line 555 of file logger.cpp.

References jami::debugEnabled_.

◆ setFileLog()

void jami::Logger::setFileLog ( const std::string &  path)
static

Definition at line 526 of file logger.cpp.

References jami::FileLog::instance(), and jami::FileLog::setFile().

Here is the call graph for this function:

◆ setMonitorLog()

void jami::Logger::setMonitorLog ( bool  enable)
static

Definition at line 437 of file logger.cpp.

References jami::emitSignal(), jami::Logger::Handler::enable(), and jami::MonitorLog::instance().

Here is the call graph for this function:

◆ setSysLog()

void jami::Logger::setSysLog ( bool  enable)
static

Definition at line 413 of file logger.cpp.

References jami::emitSignal(), jami::Logger::Handler::enable(), and jami::SysLog::instance().

Here is the call graph for this function:

◆ vlog()

void jami::Logger::vlog ( int  level,
const char file,
int  line,
bool  linefeed,
const char fmt,
va_list  ap 
)
static

Printf fashion logging (using va_list parameters)

Definition at line 567 of file logger.cpp.

References jami::debugEnabled_, jami::emitSignal(), jami::ConsoleLog::instance(), jami::SysLog::instance(), jami::MonitorLog::instance(), jami::FileLog::instance(), and jami::log_to_if_enabled().

Referenced by log().

Here is the call graph for this function:

◆ write()

void jami::Logger::write ( int  level,
const char file,
int  line,
bool  linefeed,
std::string &&  message 
)
static

Definition at line 588 of file logger.cpp.

References jami::emitSignal(), jami::ConsoleLog::instance(), jami::SysLog::instance(), jami::MonitorLog::instance(), jami::FileLog::instance(), and jami::log_to_if_enabled().

Referenced by writeDht().

Here is the call graph for this function:

◆ writeDht()

static void jami::Logger::writeDht ( dht::log::LogLevel  level,
std::string &&  message 
)
inlinestatic

Definition at line 124 of file logger.h.

References dhtLevel(), jami::emitSignal(), and write().

Here is the call graph for this function:

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