utilities/include/logger.h
00001 /******************************************************************************** 00002 * FARSA Utilities Library * 00003 * Copyright (C) 2007-2011 Gianluca Massera <emmegian@yahoo.it> * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the Free Software * 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00018 ********************************************************************************/ 00019 00020 #ifndef LOGGER_H 00021 #define LOGGER_H 00022 00023 #include "utilitiesconfig.h" 00024 #include <QString> 00025 00026 class QTextEdit; 00027 00028 namespace farsa { 00029 00050 class FARSA_UTIL_API Logger { 00051 public: 00052 enum LogLevel { 00054 Default = 0, 00056 Warning, 00058 Quiet, 00060 Superquiet 00061 }; 00062 00063 public: 00067 static void info( QString msg ); 00071 static void warning( QString msg ); 00075 static void error( QString msg ); 00081 static void setLogFilename( QString logfile ); 00083 static void setQTextEdit( QTextEdit* textedit ); 00087 static void enableStdOut( bool enabled ); 00091 static void setLogLevel(LogLevel level); 00096 static QString logLevelToString(LogLevel level); 00101 static LogLevel stringToLogLevel(QString level); 00102 private: 00104 Logger(); 00106 ~Logger(); 00107 }; 00108 00109 } // end namespace farsa 00110 00111 #endif