Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#include <httq/Logger.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace httq
|
||||
{
|
||||
|
||||
Logger *LoggerFactory::createLogger(QObject *parent)
|
||||
{
|
||||
return new Logger(this, parent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Logger::Logger(LoggerFactory *loggerFactory, QObject *parent)
|
||||
: QObject(parent)
|
||||
, mLoggerFactory(loggerFactory)
|
||||
{
|
||||
if (parent == nullptr)
|
||||
{
|
||||
|
||||
mPath = QStringLiteral("Global");
|
||||
}
|
||||
else
|
||||
{
|
||||
mPath = QString::fromUtf8(parent->metaObject()->className());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Logger::debug(const QString &message)
|
||||
{
|
||||
|
||||
qtLogger(QStringLiteral("DEBUG"), qWarning()) << message;
|
||||
}
|
||||
|
||||
|
||||
void Logger::warning(const QString &message)
|
||||
{
|
||||
qtLogger(QStringLiteral("WARNING"), qWarning()) << message;
|
||||
}
|
||||
|
||||
|
||||
void Logger::error(const QString &message)
|
||||
{
|
||||
qtLogger(QStringLiteral("ERROR"), qCritical()) << message;
|
||||
}
|
||||
|
||||
|
||||
QDebug Logger::qtLogger(const QString &type, QDebug logger)
|
||||
{
|
||||
QDebug d(logger.noquote());
|
||||
d << type << mPath << ":";
|
||||
return d;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user