Ring Daemon
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, unsigned line, bool linefeed)
 
 Logger (Logger &&) noexcept=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 (const std::string &tag={})
 
static void fini ()
 
static Logger log (int level, const char *file, unsigned line, bool linefeed)
 
static LIBJAMI_PUBLIC void log (int level, const char *file, unsigned 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, unsigned line, bool linefeed, const char *fmt, va_list)
 Printf fashion logging (using va_list parameters)
 
static LIBJAMI_PUBLIC void write (int level, std::string_view file, unsigned line, bool linefeed, std::string_view tag, std::string &&message)
 
static void writeDht (dht::log::source_loc loc, dht::log::LogLevel level, std::string_view tag, std::string &&message)
 

Detailed Description

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

Definition at line 79 of file logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/4]

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

Definition at line 85 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 &&  )
defaultnoexcept

◆ ~Logger()

jami::Logger::~Logger ( )
inline

Definition at line 96 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 614 of file logger.cpp.

References jami::debugEnabled_.

◆ dhtLevel()

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

Definition at line 105 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 ( const std::string &  tag = {})
inlinestatic

Definition at line 129 of file logger.h.

◆ fini()

void jami::Logger::fini ( )
static

Definition at line 647 of file logger.cpp.

References jami::LogDispatcher::enableFileLog(), jami::LogDispatcher::instance(), and jami::LogDispatcher::stop().

Here is the call graph for this function:

◆ log() [1/2]

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

Definition at line 159 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,
unsigned  line,
bool  linefeed,
const char *const  fmt,
  ... 
)
static

Printf fashion logging.

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

Definition at line 597 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 99 of file logger.h.

◆ setConsoleLog()

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

Definition at line 573 of file logger.cpp.

References jami::emitSignal(), jami::LogDispatcher::enableConsoleLog(), and jami::LogDispatcher::instance().

Here is the call graph for this function:

◆ setDebugMode()

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

Definition at line 608 of file logger.cpp.

References jami::debugEnabled_.

◆ setFileLog()

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

Definition at line 591 of file logger.cpp.

References jami::LogDispatcher::enableFileLog(), and jami::LogDispatcher::instance().

Here is the call graph for this function:

◆ setMonitorLog()

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

Definition at line 585 of file logger.cpp.

References jami::emitSignal(), jami::LogDispatcher::enableMonitorLog(), and jami::LogDispatcher::instance().

Here is the call graph for this function:

◆ setSysLog()

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

Definition at line 579 of file logger.cpp.

References jami::emitSignal(), jami::LogDispatcher::enableSysLog(), and jami::LogDispatcher::instance().

Here is the call graph for this function:

◆ vlog()

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

Printf fashion logging (using va_list parameters)

Definition at line 620 of file logger.cpp.

References jami::debugEnabled_, jami::emitSignal(), jami::LogDispatcher::instance(), and jami::LogDispatcher::log().

Referenced by log().

Here is the call graph for this function:

◆ write()

void jami::Logger::write ( int  level,
std::string_view  file,
unsigned  line,
bool  linefeed,
std::string_view  tag,
std::string &&  message 
)
static

Definition at line 636 of file logger.cpp.

References jami::emitSignal(), jami::LogDispatcher::instance(), and jami::LogDispatcher::log().

Referenced by writeDht().

Here is the call graph for this function:

◆ writeDht()

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

Definition at line 122 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: