FactDev  0.1
log.h
1 #ifndef LOG_H
2 #define LOG_H
3 #include <QFile>
4 #include <QDate>
5 #include <QCoreApplication>
6 #include <QTextStream>
7 #include <QDebug>
8 #include <QString>
9 
10 #include "parameters.h"
11 
12 namespace Utils {
16 typedef enum {INFO, ERROR, WARNING } TypeLog;
17 
21 class Log
22 {
23 public:
29  static Log &instance(TypeLog type=INFO);
30 
35  void write(const QString text);
36 
40  Log();
41 
48  friend Log &operator << (Log &logger, const QString& text) {
49  logger.write(text);
50 
51  return logger;
52  }
53 private:
54  static Log* _instance;
55  static TypeLog _type;
56 
57  QFile* _file;
58 
63  QString head();
64 
70  QString typeLog2String(TypeLog type);
71 };
72 }
73 #endif // LOG_H
static Log & instance(TypeLog type=INFO)
Log::instance. Return the instance of logger.
Definition: log.cpp:19
void write(const QString text)
Log::write. Write log message in file.
Definition: log.cpp:35
Log()
Log::Log. Log is a singleton.
Definition: log.cpp:8
friend Log & operator<<(Log &logger, const QString &text)
operator << for log writing
Definition: log.h:48
The Log class for Simple management of log.
Definition: log.h:21