#include <swcdb/core/Logger.h>
Public Member Functions | |
LogWriter () noexcept | |
LogWriter (LogWriter &&)=delete | |
LogWriter (const LogWriter &)=delete | |
LogWriter & | operator= (const LogWriter &)=delete |
LogWriter & | operator= (LogWriter &&)=delete |
~LogWriter () noexcept | |
void | initialize (const std::string &name) |
void | daemon (const std::string &logs_path) |
constexpr SWC_CAN_INLINE const std::string & | name () const noexcept |
constexpr SWC_CAN_INLINE void | set_level (uint8_t level) noexcept |
constexpr SWC_CAN_INLINE uint8_t | get_level () const noexcept |
constexpr SWC_CAN_INLINE bool | is_enabled (uint8_t level) const noexcept |
constexpr SWC_CAN_INLINE bool | show_line_numbers () const noexcept |
void | log (uint8_t priority, const char *fmt,...) noexcept __attribute__((format(printf |
void void | log (uint8_t priority, const char *filen, int fline, const char *fmt,...) noexcept __attribute__((format(printf |
template<typename T > | |
void void SWC_SHOULD_NOT_INLINE void | msg (uint8_t priority, const T &msg) noexcept |
template<typename T > | |
SWC_SHOULD_NOT_INLINE void | msg (uint8_t priority, const char *filen, int fline, const T &msg) noexcept |
void | _print_prefix (uint8_t priority, const char *filen, int fline) |
Static Public Member Functions | |
static std::string | repr (uint8_t priority) |
static uint8_t SWC_PURE_FUNC | from_string (const std::string &loglevel) noexcept |
Public Attributes | |
MutexSptd | mutex |
Private Member Functions | |
void | _time_and_level (uint8_t priority) |
void | _renew_files (time_t secs) |
Private Attributes | |
std::string | m_name |
std::string | m_logs_path |
FILE * | m_file_out |
Core::Atomic< uint8_t > | m_priority |
bool | m_show_line_numbers |
bool | m_daemon |
time_t | m_next_time |
|
noexcept |
|
delete |
|
delete |
SWC_SHOULD_NOT_INLINE void SWC::Core::LogWriter::_print_prefix | ( | uint8_t | priority, |
const char * | filen, | ||
int | fline | ||
) |
Definition at line 195 of file Logger.cc.
References _time_and_level(), show_line_numbers(), and SWC_LOG_OSTREAM.
Referenced by msg().
|
private |
Definition at line 117 of file Logger.cc.
References SWC::Common::Files::Schema::filepath(), m_file_out, m_logs_path, m_name, m_next_time, SWC_LOG_OSTREAM, SWC_MKDIR, and SWC::Core::to_string().
Referenced by _time_and_level(), and daemon().
|
private |
Definition at line 101 of file Logger.cc.
References _renew_files(), m_daemon, m_next_time, and SWC_LOG_OSTREAM.
Referenced by _print_prefix(), log(), and msg().
SWC_SHOULD_NOT_INLINE void SWC::Core::LogWriter::daemon | ( | const std::string & | logs_path | ) |
Definition at line 80 of file Logger.cc.
References _renew_files(), SWC::Error::get_text(), m_daemon, m_logs_path, mutex, and SWC::Core::to_string().
Referenced by SWC::Config::Settings::init_process().
|
staticnoexcept |
Definition at line 44 of file Logger.cc.
References SWC::LOG_ALERT, SWC::LOG_CRIT, SWC::LOG_DEBUG, SWC::LOG_ERROR, SWC::LOG_FATAL, SWC::LOG_INFO, SWC::LOG_NOTICE, SWC::LOG_WARN, and SWC::Condition::str_case_eq().
Referenced by SWC::Config::Settings::init_options().
|
inlineconstexprnoexcept |
Definition at line 90 of file Logger.h.
References m_priority.
SWC_SHOULD_NOT_INLINE void SWC::Core::LogWriter::initialize | ( | const std::string & | name | ) |
|
inlineconstexprnoexcept |
Definition at line 95 of file Logger.h.
References m_priority.
|
noexcept |
Definition at line 177 of file Logger.cc.
References _time_and_level(), mutex, show_line_numbers(), and SWC_LOG_OSTREAM.
|
noexcept |
Definition at line 162 of file Logger.cc.
References _time_and_level(), mutex, and SWC_LOG_OSTREAM.
|
inlinenoexcept |
Definition at line 123 of file Logger.h.
References _print_prefix(), msg(), mutex, and SWC_LOG_OSTREAM.
|
inlinenoexcept |
Definition at line 113 of file Logger.h.
References _time_and_level(), mutex, and SWC_LOG_OSTREAM.
Referenced by msg().
|
inlineconstexprnoexcept |
Definition at line 80 of file Logger.h.
References m_name.
Referenced by initialize().
|
static |
Definition at line 38 of file Logger.cc.
References SWC::LOG_DEBUG, and SWC::Core::to_string().
Referenced by SWC::Config::Settings::init_options().
|
inlineconstexprnoexcept |
Definition at line 85 of file Logger.h.
References m_priority, and SWC::Core::AtomicBase< T, OrderT >::store().
Referenced by SWC::Config::Settings::init_options().
|
inlineconstexprnoexcept |
Definition at line 100 of file Logger.h.
References m_show_line_numbers.
Referenced by _print_prefix(), and log().
|
private |
Definition at line 147 of file Logger.h.
Referenced by _time_and_level(), and daemon().
|
private |
Definition at line 143 of file Logger.h.
Referenced by _renew_files().
|
private |
Definition at line 142 of file Logger.h.
Referenced by _renew_files(), and daemon().
|
private |
Definition at line 141 of file Logger.h.
Referenced by _renew_files(), initialize(), and name().
|
private |
Definition at line 148 of file Logger.h.
Referenced by _renew_files(), and _time_and_level().
|
private |
Definition at line 145 of file Logger.h.
Referenced by get_level(), is_enabled(), and set_level().
|
private |
Definition at line 146 of file Logger.h.
Referenced by show_line_numbers().
MutexSptd SWC::Core::LogWriter::mutex |