24 #include <QtCore/QDir>
25 #include <QtCore/QFile>
26 #include <QtCore/QTextStream>
80 tmp +=
"; log file name: \"" +
fileName_ +
"\"";
92 it.value()->write(level, facility, s, isAsync);
106 spool_.append(
new QString(str));
127 std::cout <<
"SgLogger::clearSpool(): cannot create direcory \"" << qPrintable(
dirName_)
130 if (file2write.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered))
132 QTextStream ts(&file2write);
133 for (
int i=0; i<
spool_.size(); i++)
134 ts << *
spool_.at(i) << endl;
139 std::cout <<
"SgLogger::clearSpool(): cannot open log file \"" << file2write.error() <<
"\"\n";
142 delete spool_.takeFirst();
153 if (QFile::exists(target))
154 if (!QFile::remove(target))
156 "::rmLogFile(): cannot remove the file \"" + target +
"\"");
166 std::cerr << qPrintable(s) <<
"\n";
176 "::attachSupplementLog(): the log \"" + name +
"\" is NULL");
179 "::attachSupplementLog(): the log \"" + name +
"\" was already added to the map");
193 "::detachSupplementLog(): the log \"" + name +
"\" is not in the map");
virtual void write(LogLevel, quint32, const QString &, bool=false)
SgLogger(int capacity=100, bool isStoreInFile=false, const QString &fileName="logger.log")
void attachSupplementLog(const QString &name, SgLogger *auxLogger)
SgLogger * lookupSupplementLog(const QString &name)
virtual void makeOutput(LogLevel level, const QString &s, bool isAsync)
QMap< QString, SgLogger * > logSupplements_
QString className() const
virtual void clearSpool()
QList< QString * > spool_
double facilitiesSerialNumber_
quint32 logFacilities_[4]
bool isEligible(LogLevel lvl, quint32 f) const
void detachSupplementLog(const QString &name)
@ F_YYYYMMDDHHMMSSSS
Long verbose: Fri, the 2nd of Apr, 2010; 17hr 02min 43.6400sec.
@ F_HHMMSS
Just time: 17:02:43.6.
QString toString(Format format=F_Verbose) const
static SgMJD currentMJD()