QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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:
38
42 static QgsServerLogger *instance();
43
48 Qgis::MessageLevel logLevel() const { return mLogLevel; }
49
54 void setLogLevel( Qgis::MessageLevel level );
55
59 void setLogFile( const QString &filename = QString() );
60
65 void setLogStderr();
66
67 public slots:
68
76 void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level ) override;
77
78 protected:
80
81 private:
82 static QgsServerLogger *sInstance;
83
84 QFile mLogFile;
85 bool mLogStderr = false;
86 QTextStream mTextStream;
88};
89
90#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.