Vidalia 0.2.10
|
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 ** \version $Id: LogEvent.h 3735 2009-04-28 20:28:01Z edmanm $ 00014 ** \brief Event dispatched containing a log message from Tor 00015 */ 00016 00017 #ifndef _LOGEVENT_H 00018 #define _LOGEVENT_H 00019 00020 #include <QCoreApplication> 00021 #include <QString> 00022 #include <QEvent> 00023 00024 00025 class LogEvent : public QEvent 00026 { 00027 Q_DECLARE_TR_FUNCTIONS(LogEvent) 00028 00029 public: 00030 /** Log message severity levels */ 00031 enum Severity { 00032 Unknown = 0, 00033 Debug = (1u<<4), /**< Debug level log message. */ 00034 Info = (1u<<3), /**< Info level log message. */ 00035 Notice = (1u<<2), /**< Notice level log message. */ 00036 Warn = (1u<<1), /**< Warn level log message. */ 00037 Error = (1u<<0) /**< Error level log message. */ 00038 }; 00039 00040 /** Default constructor */ 00041 LogEvent(Severity severity, QString message); 00042 00043 /** Converts the string description of a severity to its enum value */ 00044 static Severity toSeverity(QString strSeverity); 00045 /** Converts the Severity enum value to a string description */ 00046 static QString severityToString(Severity severity); 00047 00048 /** Returns the severity of this log event */ 00049 Severity severity() const; 00050 /** Returns the message for this log event */ 00051 QString message() const; 00052 00053 private: 00054 Severity _severity; 00055 QString _message; 00056 }; 00057 00058 #endif 00059