Torc  0.1
Macros | Functions | Variables
torclogging.h File Reference
#include <stdint.h>
#include <errno.h>
#include "torcloggingdefs.h"
Include dependency graph for torclogging.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define VERBOSE_LEVEL_NONE   (gVerboseMask == 0)
 
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)   (((gVerboseMask & (_MASK_)) == (_MASK_)) && gLogLevel >= (_LEVEL_))
 
#define LOG(_MASK_, _LEVEL_, _STRING_)
 
#define ENO   (QString("\n\t\t\teno: ") + LogErrorToString(errno))
 
#define ENO_STR   ENO.toLocal8Bit().constData()
 

Functions

void PrintLogLine (uint64_t mask, LogLevel level, const char *file, int line, const char *function, const char *format,...)
 
void StartLogging (const QString &Logfile, int progress=0, int quiet=0, const QString &level=QStringLiteral("info"), bool Propagate=false)
 
void StopLogging (void)
 
void CalculateLogPropagation (void)
 
bool GetQuietLogPropagation (void)
 
LogLevel GetLogLevel (const QString &level)
 
QString GetLogLevelName (LogLevel level)
 
int ParseVerboseArgument (const QString &arg)
 
QString LogErrorToString (int errnum)
 

Variables

LogLevel gLogLevel
 
uint64_t gVerboseMask
 
QString gLogPropagationArgs
 
QString gVerboseString
 

Macro Definition Documentation

#define ENO   (QString("\n\t\t\teno: ") + LogErrorToString(errno))

This can be appended to the LOG args with "+". Please do not use "<<". It uses a thread safe version of strerror to produce the string representation of errno and puts it on the next line in the verbose output.

Definition at line 56 of file torclogging.h.

#define ENO_STR   ENO.toLocal8Bit().constData()

Definition at line 57 of file torclogging.h.

#define LOG (   _MASK_,
  _LEVEL_,
  _STRING_ 
)
Value:
do { \
if (VERBOSE_LEVEL_CHECK((_MASK_), (_LEVEL_)) && ((_LEVEL_)>=0)) \
{ \
PrintLogLine(_MASK_, (LogLevel)_LEVEL_, \
__FILE__, __LINE__, __FUNCTION__, \
_STRING_.toLocal8Bit().constData()); \
} \
} while (false)
void PrintLogLine(uint64_t mask, LogLevel level, const char *file, int line, const char *function, const char *format,...)
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)
Definition: torclogging.h:17

Definition at line 20 of file torclogging.h.

#define VERBOSE_LEVEL_CHECK (   _MASK_,
  _LEVEL_ 
)    (((gVerboseMask & (_MASK_)) == (_MASK_)) && gLogLevel >= (_LEVEL_))

Definition at line 17 of file torclogging.h.

#define VERBOSE_LEVEL_NONE   (gVerboseMask == 0)

Definition at line 16 of file torclogging.h.

Function Documentation

void CalculateLogPropagation ( void  )

Definition at line 624 of file torcloggingimp.cpp.

LogLevel GetLogLevel ( const QString &  level)

Definition at line 757 of file torcloggingimp.cpp.

QString GetLogLevelName ( LogLevel  level)

Definition at line 777 of file torcloggingimp.cpp.

bool GetQuietLogPropagation ( void  )

Definition at line 641 of file torcloggingimp.cpp.

QString LogErrorToString ( int  errnum)

Definition at line 978 of file torcloggingimp.cpp.

int ParseVerboseArgument ( const QString &  arg)

Definition at line 873 of file torcloggingimp.cpp.

void PrintLogLine ( uint64_t  mask,
LogLevel  level,
const char *  file,
int  line,
const char *  function,
const char *  format,
  ... 
)

Definition at line 588 of file torcloggingimp.cpp.

void StartLogging ( const QString &  Logfile,
int  progress = 0,
int  quiet = 0,
const QString &  level = QStringLiteral("info"),
bool  Propagate = false 
)

Definition at line 646 of file torcloggingimp.cpp.

void StopLogging ( void  )

Definition at line 688 of file torcloggingimp.cpp.

Variable Documentation

LogLevel gLogLevel

Definition at line 281 of file torcloggingimp.cpp.

QString gLogPropagationArgs

Definition at line 276 of file torcloggingimp.cpp.

uint64_t gVerboseMask

Definition at line 308 of file torcloggingimp.cpp.

QString gVerboseString

Definition at line 309 of file torcloggingimp.cpp.