defuze.me  Client
logger.hpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #ifndef LOGGER_HPP
00012 #define LOGGER_HPP
00013 
00014 #include "singleton.hpp"
00015 #include <QtCore/QFile>
00016 #include <QDesktopServices>
00017 
00018 const static QString gl_MAIN_LOG_DIR = "/logs";                                                     
00019 const static QString gl_MAIN_LOG_FILE = "log";                                                      
00020 const static QString gl_MAIN_LOG_EXT = "txt";                                                       
00021 
00037 class Logger : public Singleton<Logger>
00038 {
00039     friend class Singleton<Logger>;
00040 public:
00041     static void log(const QString &message);                                                        
00042 
00043 protected:
00044     Logger();
00045     ~Logger();
00046 
00047 private:
00048     void updateLog(QString msg) const;
00049     QByteArray logHeader() const;
00050     QString logFileName() const;
00051     QFile *logFile;
00052 };
00053 
00054 #endif // LOGGER_HPP