00001 /**************************************************************** 00002 * Vidalia is distributed under the following license: 00003 * 00004 * Copyright (C) 2006, Matt Edman, Justin Hipple 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 ****************************************************************/ 00021 00022 /** 00023 * \file logevent.h 00024 * \version $Id: logevent.h 1563 2006-12-26 06:06:04Z edmanm $ 00025 * \brief Event dispatched containing a log message from Tor 00026 */ 00027 00028 #ifndef _LOGEVENT_H 00029 #define _LOGEVENT_H 00030 00031 #include <QCoreApplication> 00032 #include <QString> 00033 #include <QEvent> 00034 00035 00036 class LogEvent : public QEvent 00037 { 00038 Q_DECLARE_TR_FUNCTIONS(LogEvent) 00039 00040 public: 00041 /** Log message severity levels */ 00042 enum Severity { 00043 Unknown = 0, 00044 Debug = (1u<<4), /**< Debug level log message. */ 00045 Info = (1u<<3), /**< Info level log message. */ 00046 Notice = (1u<<2), /**< Notice level log message. */ 00047 Warn = (1u<<1), /**< Warn level log message. */ 00048 Error = (1u<<0) /**< Error level log message. */ 00049 }; 00050 00051 /** Default constructor */ 00052 LogEvent(Severity severity, QString message); 00053 00054 /** Converts the string description of a severity to its enum value */ 00055 static Severity toSeverity(QString strSeverity); 00056 /** Converts the Severity enum value to a string description */ 00057 static QString severityToString(Severity severity); 00058 00059 /** Returns the severity of this log event */ 00060 Severity severity(); 00061 /** Returns the message for this log event */ 00062 QString message(); 00063 00064 private: 00065 Severity _severity; 00066 QString _message; 00067 }; 00068 00069 #endif 00070