Update QsLog to 2.1 snapshot 46b643d5bcbc

This commit is contained in:
Felix Kauselmann
2020-07-24 19:05:01 +02:00
parent c13ec618d0
commit 1568a5f253
45 changed files with 2579 additions and 269 deletions

View File

@ -27,31 +27,40 @@
#include "QsLogDestFunctor.h"
#include <cstddef>
#include <QtGlobal>
#include <QString>
const char* const QsLogging::FunctorDestination::Type = "functor";
QsLogging::FunctorDestination::FunctorDestination(LogFunction f)
: QObject(NULL)
: QObject(nullptr)
, mLogFunction(f)
{
}
QsLogging::FunctorDestination::FunctorDestination(QObject *receiver, const char *member)
: QObject(NULL)
, mLogFunction(NULL)
QsLogging::FunctorDestination::FunctorDestination(QObject* receiver, const char* member)
: QObject(nullptr)
, mLogFunction(nullptr)
{
connect(this, SIGNAL(logMessageReady(QString,int)), receiver, member, Qt::QueuedConnection);
connect(this, SIGNAL(logMessageReady(QsLogging::LogMessage)),
receiver, member, Qt::QueuedConnection);
}
void QsLogging::FunctorDestination::write(const QString &message, QsLogging::Level level)
void QsLogging::FunctorDestination::write(const LogMessage& message)
{
if (mLogFunction)
mLogFunction(message, level);
mLogFunction(message);
if (level > QsLogging::TraceLevel)
emit logMessageReady(message, static_cast<int>(level));
if (message.level > QsLogging::TraceLevel)
emit logMessageReady(message);
}
bool QsLogging::FunctorDestination::isValid()
{
return true;
}
QString QsLogging::FunctorDestination::type() const
{
return QString::fromLatin1(Type);
}