QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsserverlogger.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsserverlogger.h
3 -----------------
4 begin : May 5, 2014
5 copyright : (C) 2014 by Marco Hugentobler
6 email : marco dot hugentobler at sourcepole dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSERVERLOGGER_H
19#define QGSSERVERLOGGER_H
20
21
22#include "qgsmessagelog.h"
23
24#include <QFile>
25#include <QObject>
26#include <QString>
27#include <QTextStream>
28#include "qgis_server.h"
29
34class SERVER_EXPORT QgsServerLogger : public QgsMessageLogConsole
35{
36 Q_OBJECT
37 public:
41 static QgsServerLogger *instance();
42
47 Qgis::MessageLevel logLevel() const { return mLogLevel; }
48
53 void setLogLevel( Qgis::MessageLevel level );
54
58 void setLogFile( const QString &filename = QString() );
59
64 void setLogStderr();
65
66 public slots:
67
75 void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level ) override;
76
77 protected:
79
80 private:
81 static QgsServerLogger *sInstance;
82
83 QFile mLogFile;
84 bool mLogStderr = false;
85 QTextStream mTextStream;
87};
88
89#endif // QGSSERVERLOGGER_H
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:154
@ NoLevel
No level.
Definition qgis.h:159
Default implementation of message logging interface.
virtual void logMessage(const QString &message, const QString &tag, Qgis::MessageLevel level)
Logs a message to stderr.
Writes message log into server logfile.
Qgis::MessageLevel logLevel() const
Gets the current log level.