78 assert(!
"bad log level");
98Logger::Logger(
const QString& aZone) :
168void Logger::Helper::writeToLog()
173 ts << QThread::currentThread();
174 const QString completeMessage(QString(QLatin1String(
"%1 %2 %3 %4"))
175 .arg(QDateTime::currentDateTime().toString(*fmtDateTime))
181 QMutexLocker lock(&logger.d->
logMutex);
183 logger.write(completeMessage);
200void Logger::write(
const QString& message)
203 if (message.isNull())
205 std::cerr <<
"Logger::write null message for " << d->
zone.toUtf8().constData() << std::endl << std::flush;
208 for(DestinationList::iterator it = d->
destList.begin(),
209 endIt = d->
destList.end();it != endIt;++it)
213 assert(!
"null log destination");
216 (*it)->write(message, d->
zone);
LIMA_COMMONQSLOG_EXPORT QDebug & operator<<(QDebug &qd, const std::string &str)
#define LIMA_COMMONQSLOG_EXPORT
LoggerImpl(const QString &aZone)
bool isLoggingEnabled() const
Returns true if logging level is lower than or equal to FatalLevel.
bool isWarnEnabled() const
Returns true if logging level is lower than or equal to WarnLevel.
bool isErrorEnabled() const
Returns true if logging level is lower than or equal to ErrorLevel.
Level loggingLevel() const
The default level is INFO.
static Logger & instance(const QString &zone=QLatin1String(""))
bool isTraceEnabled() const
Returns true if logging level is lower than or equal to TraceLevel.
const QString & zone() const
bool isInfoEnabled() const
Returns true if logging level is lower than or equal to InfoLevel.
void setLoggingLevel(Level newLevel)
Logging at a level < 'newLevel' will be ignored.
bool isFatalEnabled() const
Returns true if logging level is lower than or equal to FatalLevel.
bool isDebugEnabled() const
Returns true if logging level is lower than or equal to DebugLevel.
void addDestination(std::shared_ptr< Destination > destination)
Adds a log message destination. Don't add null destinations.
static const char DebugString[]
Q_GLOBAL_STATIC_WITH_ARGS(QString, fmtDateTime,("yyyy-MM-ddThh:mm:ss.zzz"))
static const char ErrorString[]
QList< DestinationPtr > DestinationList
std::shared_ptr< Destination > DestinationPtr
static const char InfoString[]
static const char TraceString[]
static const char WarnString[]
static const char FatalString[]
static const char * LevelToText(Level theLevel)