Torc  0.1
Classes | Macros | Typedefs | Enumerations | Functions | Variables
torcloggingimp.cpp File Reference
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <iostream>
#include <QtGlobal>
#include <QMutex>
#include <QList>
#include <QTime>
#include <QRegExp>
#include <QHash>
#include <QMap>
#include <QByteArray>
#include <QFileInfo>
#include <QStringList>
#include <QQueue>
#include "torcexitcodes.h"
#include "torccompat.h"
#include "torclogging.h"
#include "torcloggingimp.h"
#include "torcloggingdefs.h"
Include dependency graph for torcloggingimp.cpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  LogItem
 
struct  LogPropagateOpts
 
struct  VerboseDef
 
struct  LoglevelDef
 

Macros

#define TIMESTAMP_MAX   30
 
#define MAX_STRING_LENGTH   (LOGLINE_MAX+120)
 
#define _IMPLEMENT_VERBOSE
 

Typedefs

typedef QMap< QString, VerboseDefVerboseMap
 
typedef QMap< int, LoglevelDefLoglevelMap
 

Enumerations

enum  LoggingType {
  kMessage = 0x01, kRegistering = 0x02, kDeregistering = 0x04, kFlush = 0x08,
  kStandardIO = 0x10
}
 

Functions

char * GetThreadName (LogItem *item)
 
int64_t GetThreadTid (LogItem *item)
 
void AddVerbose (uint64_t mask, QString name, bool additive, QString helptext)
 
void AddLogLevel (int value, QString name, char shortname)
 
void InitVerbose (void)
 
void VerboseHelp (void)
 
void PrintLogLine (uint64_t Mask, LogLevel Level, const char *File, int Line, const char *Function, const char *Format,...)
 
void CalculateLogPropagation (void)
 
bool GetQuietLogPropagation (void)
 
void StartLogging (const QString &Logfile, int progress, int quiet, const QString &Level, bool Propagate)
 
void StopLogging (void)
 
void RegisterLoggingThread (void)
 
void DeregisterLoggingThread (void)
 
LogLevel GetLogLevel (const QString &level)
 
QString GetLogLevelName (LogLevel level)
 
int ParseVerboseArgument (const QString &arg)
 
QString LogErrorToString (int errnum)
 

Variables

QMutex gLoggerListLock
 
QList< LoggerBase * > gLoggerList
 
QMutex gLogQueueLock
 
QQueue< LogItem * > gLogQueue
 
QRegExp gLogRexExp = QRegExp("[%]{1,2}")
 
QMutex gLogThreadLock
 
QHash< uint64_t, char * > gLogThreadHash
 
QMutex gLogThreadTidLock
 
QHash< uint64_t, int64_t > gLogThreadtidHash
 
LoggingThreadgLogThread = nullptr
 
bool gLogThreadFinished = false
 
LogPropagateOpts gLogPropagationOpts = { false, 0, QStringLiteral("") }
 
QString gLogPropagationArgs
 
LogLevel gLogLevel = (LogLevel)LOG_INFO
 
VerboseMap gVerboseMap
 
QMutex gVerboseMapLock
 
LoglevelMap gLoglevelMap
 
QMutex gLoglevelMapLock
 
bool gVerboseInitialised = false
 
const uint64_t gVerboseDefaultInt = VB_GENERAL
 
QString gVerboseDefaultStr = QStringLiteral(" general")
 
uint64_t gVerboseMask = gVerboseDefaultInt
 
QString gVerboseString = QString(gVerboseDefaultStr)
 
uint64_t gUserDefaultValueInt = gVerboseDefaultInt
 
QString gUserDefaultValueStr = QString(gVerboseDefaultStr)
 
bool gHaveUserDefaultValues = false
 

Macro Definition Documentation

#define _IMPLEMENT_VERBOSE
#define MAX_STRING_LENGTH   (LOGLINE_MAX+120)

Definition at line 279 of file torcloggingimp.cpp.

#define TIMESTAMP_MAX   30

Definition at line 278 of file torcloggingimp.cpp.

Typedef Documentation

typedef QMap<int, LoglevelDef> LoglevelMap

Definition at line 298 of file torcloggingimp.cpp.

typedef QMap<QString, VerboseDef> VerboseMap

Definition at line 290 of file torcloggingimp.cpp.

Enumeration Type Documentation

Enumerator
kMessage 
kRegistering 
kDeregistering 
kFlush 
kStandardIO 

Definition at line 57 of file torcloggingimp.cpp.

Function Documentation

void AddLogLevel ( int  value,
QString  name,
char  shortname 
)

Definition at line 811 of file torcloggingimp.cpp.

void AddVerbose ( uint64_t  mask,
QString  name,
bool  additive,
QString  helptext 
)

Definition at line 794 of file torcloggingimp.cpp.

void CalculateLogPropagation ( void  )

Definition at line 624 of file torcloggingimp.cpp.

void DeregisterLoggingThread ( void  )

Definition at line 744 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.

char * GetThreadName ( LogItem item)

Definition at line 534 of file torcloggingimp.cpp.

int64_t GetThreadTid ( LogItem item)

Definition at line 559 of file torcloggingimp.cpp.

void InitVerbose ( void  )

Definition at line 826 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 RegisterLoggingThread ( void  )

Definition at line 728 of file torcloggingimp.cpp.

void StartLogging ( const QString &  Logfile,
int  progress,
int  quiet,
const QString &  Level,
bool  Propagate 
)

Definition at line 646 of file torcloggingimp.cpp.

void StopLogging ( void  )

Definition at line 688 of file torcloggingimp.cpp.

void VerboseHelp ( void  )

Definition at line 840 of file torcloggingimp.cpp.

Variable Documentation

bool gHaveUserDefaultValues = false

Definition at line 312 of file torcloggingimp.cpp.

QList<LoggerBase *> gLoggerList

Definition at line 46 of file torcloggingimp.cpp.

QMutex gLoggerListLock

Definition at line 45 of file torcloggingimp.cpp.

LogLevel gLogLevel = (LogLevel)LOG_INFO

Definition at line 281 of file torcloggingimp.cpp.

LoglevelMap gLoglevelMap

Definition at line 302 of file torcloggingimp.cpp.

QMutex gLoglevelMapLock

Definition at line 303 of file torcloggingimp.cpp.

QString gLogPropagationArgs

Definition at line 276 of file torcloggingimp.cpp.

LogPropagateOpts gLogPropagationOpts = { false, 0, QStringLiteral("") }

Definition at line 275 of file torcloggingimp.cpp.

QQueue<LogItem *> gLogQueue

Definition at line 48 of file torcloggingimp.cpp.

QMutex gLogQueueLock

Definition at line 47 of file torcloggingimp.cpp.

QRegExp gLogRexExp = QRegExp("[%]{1,2}")

Definition at line 49 of file torcloggingimp.cpp.

LoggingThread* gLogThread = nullptr

Definition at line 54 of file torcloggingimp.cpp.

bool gLogThreadFinished = false

Definition at line 55 of file torcloggingimp.cpp.

QHash<uint64_t, char *> gLogThreadHash

Definition at line 51 of file torcloggingimp.cpp.

QMutex gLogThreadLock

Definition at line 50 of file torcloggingimp.cpp.

QHash<uint64_t, int64_t> gLogThreadtidHash

Definition at line 53 of file torcloggingimp.cpp.

QMutex gLogThreadTidLock

Definition at line 52 of file torcloggingimp.cpp.

uint64_t gUserDefaultValueInt = gVerboseDefaultInt

Definition at line 310 of file torcloggingimp.cpp.

QString gUserDefaultValueStr = QString(gVerboseDefaultStr)

Definition at line 311 of file torcloggingimp.cpp.

const uint64_t gVerboseDefaultInt = VB_GENERAL

Definition at line 306 of file torcloggingimp.cpp.

QString gVerboseDefaultStr = QStringLiteral(" general")

Definition at line 307 of file torcloggingimp.cpp.

bool gVerboseInitialised = false

Definition at line 305 of file torcloggingimp.cpp.

VerboseMap gVerboseMap

Definition at line 300 of file torcloggingimp.cpp.

QMutex gVerboseMapLock

Definition at line 301 of file torcloggingimp.cpp.

uint64_t gVerboseMask = gVerboseDefaultInt

Definition at line 308 of file torcloggingimp.cpp.

QString gVerboseString = QString(gVerboseDefaultStr)

Definition at line 309 of file torcloggingimp.cpp.