Vidalia 0.2.12
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If 00004 ** you did not receive the LICENSE file with this file, you may obtain it 00005 ** from the Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.vidalia-project.net/. No part of Vidalia, including this file, 00007 ** may be copied, modified, propagated, or distributed except according to 00008 ** the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file LogEvent.h 00013 ** \brief Event dispatched containing a log message from Tor 00014 */ 00015 00016 #ifndef _LOGEVENT_H 00017 #define _LOGEVENT_H 00018 00019 #include <QCoreApplication> 00020 #include <QString> 00021 #include <QEvent> 00022 00023 00024 class LogEvent : public QEvent 00025 { 00026 Q_DECLARE_TR_FUNCTIONS(LogEvent) 00027 00028 public: 00029 /** Log message severity levels */ 00030 enum Severity { 00031 Unknown = 0, 00032 Debug = (1u<<4), /**< Debug level log message. */ 00033 Info = (1u<<3), /**< Info level log message. */ 00034 Notice = (1u<<2), /**< Notice level log message. */ 00035 Warn = (1u<<1), /**< Warn level log message. */ 00036 Error = (1u<<0) /**< Error level log message. */ 00037 }; 00038 00039 /** Default constructor */ 00040 LogEvent(Severity severity, QString message); 00041 00042 /** Converts the string description of a severity to its enum value */ 00043 static Severity toSeverity(QString strSeverity); 00044 /** Converts the Severity enum value to a string description */ 00045 static QString severityToString(Severity severity); 00046 00047 /** Returns the severity of this log event */ 00048 Severity severity() const; 00049 /** Returns the message for this log event */ 00050 QString message() const; 00051 00052 private: 00053 Severity _severity; 00054 QString _message; 00055 }; 00056 00057 #endif 00058