Engauge Digitizer  2
Functions | Variables
Logger.h File Reference
#include <log4cpp/Category.hh>
#include <QString>
Include dependency graph for Logger.h:

Go to the source code of this file.

Functions

void initializeLogging (const QString &name, const QString &filename, bool isDebug)
 

Variables

log4cpp::CategorymainCat
 
const QString INDENTATION_PAST_TIMESTAMP
 
const QString INDENTATION_DELTA
 

Function Documentation

◆ initializeLogging()

void initializeLogging ( const QString &  name,
const QString &  filename,
bool  isDebug 
)

Definition at line 21 of file Logger.cpp.

24 {
25  LayoutAppender *appender = nullptr;
26 
27  const size_t MAX_FILE_SIZE_BYTES = 6 * 1024 * 1024; // Size that should satisfy most email servers
28  const unsigned int MAX_BACKUP_INDEX = 2;
29  const bool APPEND_TO_PREVIOUS_FILE = false;
30 
31  // Log to file for development
32  appender = dynamic_cast<LayoutAppender*> (new RollingFileAppender (name.toStdString (),
33  filename.toStdString (),
34  MAX_FILE_SIZE_BYTES,
35  MAX_BACKUP_INDEX,
36  APPEND_TO_PREVIOUS_FILE));
37 
38  PatternLayout *layout = new PatternLayout ();
39  // With date: %d{%H:%M:%S.%l} %-5p %c - %m%n
40  // Without date: %-5p %c - %m%n
41  layout->setConversionPattern ("%-5p %c - %m%n");
42  appender->setLayout (layout);
43 
44  mainCat = &Category::getRoot ();
45 
46  // Levels are EMERG, FATAL, ALERT, CRIT, ERROR, WARN, NOTICE, INFO, DEBUG.
47  //
48  // Most trace logging is at INFO level, but methods that are called extremely often (like mouse
49  // moves and status bar updates) are at the lower DEBUG level so they are rarely seen
50  if (isDebug) {
51  mainCat->setPriority (Priority::DEBUG);
52  } else {
53  mainCat->setPriority (Priority::INFO);
54  }
55 
56  mainCat->addAppender (appender);
57 }

Variable Documentation

◆ INDENTATION_DELTA

const QString INDENTATION_DELTA

◆ INDENTATION_PAST_TIMESTAMP

const QString INDENTATION_PAST_TIMESTAMP

◆ mainCat

Definition at line 14 of file Logger.cpp.

log4cpp::PatternLayout
Noop class that mimics the same class in the log4cpp library.
Definition: PatternLayout.hh:13
log4cpp::Category::addAppender
void addAppender(Appender *appender)
Noop method to add an Appender.
Definition: Category.cpp:15
log4cpp::Category::setPriority
void setPriority(Priority::Value priority)
Noop method to set priority.
Definition: Category.cpp:38
log4cpp::PatternLayout::setConversionPattern
void setConversionPattern(const std::string &conversionPattern)
Noop method for setting the conversion pattern.
Definition: PatternLayout.cpp:22
log4cpp::RollingFileAppender
Noop class that mimics the same class in the log4cpp library.
Definition: RollingFileAppender.hh:11
log4cpp::LayoutAppender::setLayout
virtual void setLayout(Layout *layout)=0
Set the layout for this Appender.
Definition: LayoutAppender.cpp:14
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
log4cpp::LayoutAppender
Noop class that mimics the same class in the log4cpp library.
Definition: LayoutAppender.hh:12