Vidalia  0.3.1
LogEvent.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If
4 ** you did not receive the LICENSE file with this file, you may obtain it
5 ** from the Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file LogEvent.h
13 ** \brief Event dispatched containing a log message from Tor
14 */
15 
16 #ifndef _LOGEVENT_H
17 #define _LOGEVENT_H
18 
19 #include <QCoreApplication>
20 #include <QString>
21 #include <QEvent>
22 
23 
24 class LogEvent : public QEvent
25 {
26  Q_DECLARE_TR_FUNCTIONS(LogEvent)
27 
28 public:
29  /** Log message severity levels */
30  enum Severity {
31  Unknown = 0,
32  Debug = (1u<<4), /**< Debug level log message. */
33  Info = (1u<<3), /**< Info level log message. */
34  Notice = (1u<<2), /**< Notice level log message. */
35  Warn = (1u<<1), /**< Warn level log message. */
36  Error = (1u<<0) /**< Error level log message. */
37  };
38 
39  /** Default constructor */
41 
42  /** Converts the string description of a severity to its enum value */
43  static Severity toSeverity(QString strSeverity);
44  /** Converts the Severity enum value to a string description */
45  static QString severityToString(Severity severity);
46 
47  /** Returns the severity of this log event */
48  Severity severity() const;
49  /** Returns the message for this log event */
50  QString message() const;
51 
52 private:
54  QString _message;
55 };
56 
57 #endif
58 
QString message() const
Definition: LogEvent.cpp:75
Severity severity() const
Definition: LogEvent.cpp:68
QString _message
Definition: LogEvent.h:54
Severity _severity
Definition: LogEvent.h:53
LogEvent(Severity severity, QString message)
Definition: LogEvent.cpp:21
static Severity toSeverity(QString strSeverity)
Definition: LogEvent.cpp:30
static QString severityToString(Severity severity)
Definition: LogEvent.cpp:52