20 #include <QCoreApplication> 22 #include <QTextStream> 45 if ( mLogLevel > level )
49 if ( mLogFile.isOpen() )
52 mTextStream << formattedMessage;
55 else if ( mLogStderr )
70 mLogFile.setFileName( filename );
72 if ( ( ! filename.isEmpty() ) && mLogFile.open( QIODevice::Append ) )
74 mTextStream.setDevice( &mLogFile );
void logMessage(const QString &message, const QString &tag, Qgis::MessageLevel level) override
Log a message from the server context.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
void setLogLevel(Qgis::MessageLevel level)
Set the current log level.
virtual void logMessage(const QString &message, const QString &tag, Qgis::MessageLevel level)
Logs a message to stderr.
Writes message log into server logfile.
Default implementation of message logging interface.
void setLogStderr()
Activates logging to stderr.
QString formatLogMessage(const QString &message, const QString &tag, Qgis::MessageLevel level=Qgis::Info) const
Formats a log message.
static QgsServerLogger * instance()
Gets the singleton instance.
void setLogFile(const QString &filename=QString())
Set the current log file.