11 #include <QtCore/QDateTime>
12 #include <QtCore/QString>
13 #include <QtCore/QFileInfo>
14 #include <QtCore/QDir>
15 #include <QtCore/QMutexLocker>
29 {
"ERROR ",
"WARNING ",
"INFO ",
"VERBOSEINFO ",
"DEBUG ",
"DEBUG1 ",
"DEBUG2 ",
"DEBUG3 ",
"DEBUG4 "};
33 if (_loggingLevel < level)
37 _instance = std::tr1::shared_ptr<Log>(
new Log());
38 _instance->addline(level,line);
45 _instance = std::tr1::shared_ptr<Log>(
new Log());
53 _instance = std::tr1::shared_ptr<Log>(
new Log());
54 return _instance->_filename;
66 for (
int i(0); i < nbrOfLogLevel ; ++i)
68 if (s.
value(
"MaxLoggingLevel",
"INFO").toString() +
" " == _level2string[i])
70 _loggingLevel =
static_cast<Level>(i);
76 QString tmpfilename(
"casslog_" +
79 QString filename(s.
value(
"Filename",tmpfilename).toString());
81 if(fileinfo.filePath().toStdString() != _filename)
85 _log.open(fileinfo.filePath().toUtf8().data(), ios_base::out | ios_base::app);
86 _filename = fileinfo.filePath().toStdString();
98 << _level2string[level]
void load()
load the logging settings from the .ini file
static void loadSettings()
load the logging settings from the .ini file
Level
the logging levels available
static std::tr1::shared_ptr< Log > _instance
the instance
static Level _loggingLevel
the used logging level
static void add(Level level, const std::string &line)
add a string to the log
static const char * _level2string[]
map the level to a string
static QMutex _lock
mutex to lock the singleton
a logger for logging debug and info messages
std::string toString(const Type &t)
convert any type to a string
value(const QString &key, const QVariant &defaultValue=QVariant()
void addline(Level level, const std::string &line)
add a string to the log
file contains specialized class that do the settings for cass
static std::string filename()
return the name of the log file
contains a logger for cass
beginGroup(const QString &prefix)