DABC (Data Acquisition Backbone Core)  2.9.9
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Private Attributes
dabc::Logger Class Reference

Logging class. More...

#include <dabc/logging.h>

Public Types

enum  EShowInfo {
  lPrefix = 0x0001 , lDate = 0x0002 , lTime = 0x0004 , lFile = 0x0008 ,
  lFunc = 0x0010 , lLine = 0x0020 , lLevel = 0x0040 , lMessage = 0x0080 ,
  lNoDrop = 0x0100 , lNoPrefix = 0x0200 , lTStamp = 0x0400 , lSyslgLvl = 0x0800
}
 

Public Member Functions

void CloseFile ()
 Close any file open by logger. More...
 
int GetDebugLevel () const
 
unsigned GetDebugMask () const
 
unsigned GetErrorMask () const
 
int GetFileLevel () const
 
unsigned GetFileMask () const
 
const char * GetPrefix ()
 
virtual void LogFile (const char *fname)
 
 Logger (bool withmutex=true)
 
void SetDebugLevel (int level=0)
 
void SetDebugMask (unsigned mask)
 
void SetErrorMask (unsigned mask)
 
void SetFileLevel (int level=0)
 
void SetFileMask (unsigned mask)
 
void SetLogLimit (unsigned limit=100)
 
void SetPrefix (const char *prefix=0)
 
void SetSyslogLevel (int level=0)
 
void ShowStat (bool tofile=true)
 
virtual void Syslog (const char *prefix)
 
virtual ~Logger ()
 

Static Public Member Functions

static void CheckTimeout ()
 
static void Debug (int level, const char *filename, unsigned linenumber, const char *funcname, const char *message)
 
static void DisableLogReopen ()
 
static LoggerInstance ()
 

Protected Member Functions

virtual void _DoCheckTimeout ()
 
void _ExtendLines (unsigned max)
 
void _FillString (std::string &str, unsigned mask, LoggerEntry *entry)
 
virtual void DoOutput (int level, const char *filename, unsigned linenumber, const char *funcname, const char *message)
 

Static Protected Attributes

static LoggergDebug = nullptr
 

Private Attributes

int fDebugLevel
 
unsigned fDebugMask
 
unsigned fErrorMask
 
FILE * fFile
 
int fFileLevel
 
unsigned fFileMask
 
int fLevel
 
LoggerLineEntry ** fLines
 
bool fLogFileModified
 
std::string fLogFileName
 
unsigned fLogLimit
 
bool fLogReopenDisabled
 
double fLogReopenTime
 
unsigned fMaxLine
 
MutexfMutex
 
std::string fPrefix
 
LoggerfPrev
 
int fSyslogLevel
 
std::string fSyslogPrefix
 

Detailed Description

Logging class.

Accessible via dabc::lgr() function.

Definition at line 49 of file logging.h.

Member Enumeration Documentation

◆ EShowInfo

Enumerator
lPrefix 
lDate 
lTime 
lFile 
lFunc 
lLine 
lLevel 
lMessage 
lNoDrop 
lNoPrefix 
lTStamp 
lSyslgLvl 

Definition at line 51 of file logging.h.

Constructor & Destructor Documentation

◆ Logger()

dabc::Logger::Logger ( bool  withmutex = true)

Definition at line 108 of file logging.cxx.

◆ ~Logger()

dabc::Logger::~Logger ( )
virtual

Definition at line 140 of file logging.cxx.

Member Function Documentation

◆ SetDebugMask()

void dabc::Logger::SetDebugMask ( unsigned  mask)
inline

Definition at line 70 of file logging.h.

◆ GetDebugMask()

unsigned dabc::Logger::GetDebugMask ( ) const
inline

Definition at line 71 of file logging.h.

◆ SetErrorMask()

void dabc::Logger::SetErrorMask ( unsigned  mask)
inline

Definition at line 74 of file logging.h.

◆ GetErrorMask()

unsigned dabc::Logger::GetErrorMask ( ) const
inline

Definition at line 75 of file logging.h.

◆ SetFileMask()

void dabc::Logger::SetFileMask ( unsigned  mask)
inline

Definition at line 78 of file logging.h.

◆ GetFileMask()

unsigned dabc::Logger::GetFileMask ( ) const
inline

Definition at line 79 of file logging.h.

◆ SetDebugLevel()

void dabc::Logger::SetDebugLevel ( int  level = 0)

Definition at line 170 of file logging.cxx.

◆ SetFileLevel()

void dabc::Logger::SetFileLevel ( int  level = 0)

Definition at line 176 of file logging.cxx.

◆ SetSyslogLevel()

void dabc::Logger::SetSyslogLevel ( int  level = 0)

Definition at line 182 of file logging.cxx.

◆ SetLogLimit()

void dabc::Logger::SetLogLimit ( unsigned  limit = 100)
inline

Definition at line 85 of file logging.h.

◆ GetDebugLevel()

int dabc::Logger::GetDebugLevel ( ) const
inline

Definition at line 86 of file logging.h.

◆ GetFileLevel()

int dabc::Logger::GetFileLevel ( ) const
inline

Definition at line 87 of file logging.h.

◆ SetPrefix()

void dabc::Logger::SetPrefix ( const char *  prefix = 0)
inline

Definition at line 89 of file logging.h.

◆ GetPrefix()

const char* dabc::Logger::GetPrefix ( )
inline

Definition at line 90 of file logging.h.

◆ LogFile()

void dabc::Logger::LogFile ( const char *  fname)
virtual

Definition at line 210 of file logging.cxx.

◆ Syslog()

void dabc::Logger::Syslog ( const char *  prefix)
virtual

Definition at line 226 of file logging.cxx.

◆ ShowStat()

void dabc::Logger::ShowStat ( bool  tofile = true)

Definition at line 410 of file logging.cxx.

◆ CloseFile()

void dabc::Logger::CloseFile ( )

Close any file open by logger.

Definition at line 161 of file logging.cxx.

◆ CheckTimeout()

void dabc::Logger::CheckTimeout ( )
static

Definition at line 398 of file logging.cxx.

◆ DisableLogReopen()

void dabc::Logger::DisableLogReopen ( )
static

Definition at line 405 of file logging.cxx.

◆ Instance()

static Logger* dabc::Logger::Instance ( )
inlinestatic

Definition at line 104 of file logging.h.

◆ Debug()

static void dabc::Logger::Debug ( int  level,
const char *  filename,
unsigned  linenumber,
const char *  funcname,
const char *  message 
)
inlinestatic

Definition at line 106 of file logging.h.

◆ DoOutput()

void dabc::Logger::DoOutput ( int  level,
const char *  filename,
unsigned  linenumber,
const char *  funcname,
const char *  message 
)
protectedvirtual

Definition at line 308 of file logging.cxx.

◆ _ExtendLines()

void dabc::Logger::_ExtendLines ( unsigned  max)
protected

Definition at line 188 of file logging.cxx.

◆ _FillString()

void dabc::Logger::_FillString ( std::string &  str,
unsigned  mask,
LoggerEntry entry 
)
protected

Definition at line 234 of file logging.cxx.

◆ _DoCheckTimeout()

void dabc::Logger::_DoCheckTimeout ( )
protectedvirtual

Definition at line 384 of file logging.cxx.

Field Documentation

◆ gDebug

dabc::Logger * dabc::Logger::gDebug = nullptr
staticprotected

Definition at line 114 of file logging.h.

◆ fPrev

Logger* dabc::Logger::fPrev
private

Definition at line 125 of file logging.h.

◆ fLines

LoggerLineEntry** dabc::Logger::fLines
private

Definition at line 126 of file logging.h.

◆ fMaxLine

unsigned dabc::Logger::fMaxLine
private

Definition at line 127 of file logging.h.

◆ fMutex

Mutex* dabc::Logger::fMutex
private

Definition at line 128 of file logging.h.

◆ fFile

FILE* dabc::Logger::fFile
private

Definition at line 129 of file logging.h.

◆ fSyslogPrefix

std::string dabc::Logger::fSyslogPrefix
private

Definition at line 130 of file logging.h.

◆ fDebugMask

unsigned dabc::Logger::fDebugMask
private

Definition at line 131 of file logging.h.

◆ fErrorMask

unsigned dabc::Logger::fErrorMask
private

Definition at line 132 of file logging.h.

◆ fFileMask

unsigned dabc::Logger::fFileMask
private

Definition at line 133 of file logging.h.

◆ fDebugLevel

int dabc::Logger::fDebugLevel
private

Definition at line 134 of file logging.h.

◆ fFileLevel

int dabc::Logger::fFileLevel
private

Definition at line 135 of file logging.h.

◆ fSyslogLevel

int dabc::Logger::fSyslogLevel
private

Definition at line 136 of file logging.h.

◆ fLevel

int dabc::Logger::fLevel
private

Definition at line 137 of file logging.h.

◆ fPrefix

std::string dabc::Logger::fPrefix
private

Definition at line 138 of file logging.h.

◆ fLogFileName

std::string dabc::Logger::fLogFileName
private

Definition at line 139 of file logging.h.

◆ fLogReopenTime

double dabc::Logger::fLogReopenTime
private

Definition at line 140 of file logging.h.

◆ fLogFileModified

bool dabc::Logger::fLogFileModified
private

Definition at line 141 of file logging.h.

◆ fLogLimit

unsigned dabc::Logger::fLogLimit
private

Definition at line 142 of file logging.h.

◆ fLogReopenDisabled

bool dabc::Logger::fLogReopenDisabled
private

Definition at line 143 of file logging.h.


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