Code_TYMPAN  4.4.0
Industrial site acoustic simulation
logging.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2014> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #ifndef TY_LOGGING
17 #define TY_LOGGING
18 
19 #include <iostream>
20 #include <time.h>
21 #include <qstring.h>
22 
23 #include "Tympan/core/smartptr.h"
24 
25 #define MSG_DEBUG 0x0001
26 #define MSG_BENCH 0x0002
27 #define MSG_INFO 0x0004
28 #define MSG_WARNING 0x0008
29 #define MSG_ERROR 0x0010
30 #define MSG_FATAL 0x0012
31 
32 class OMessageManager;
35 
45 class OMessageManager : public IRefCount
46 {
47  // Methods
48 public:
56  virtual ~OMessageManager();
57 
65  bool setAsSingleton();
69  static OMessageManager* get();
70 
74  virtual void warning(const char* message, ...);
75 
79  virtual void error(const char* message, ...);
80 
84  virtual void fatal(const char* message, ...);
85 
89  virtual void info(const char* message, ...);
90 
94  virtual void debug(const char* message, ...);
95 
99  virtual void missingFile(const char* nomFic);
100 
104  virtual void toDo(const char* message);
105 
109  virtual void trace(const char* message, ...);
110 
114  virtual void warning(const QString& message, ...);
115 
119  virtual void error(const QString& message, ...);
120 
124  virtual void fatal(const QString& message, ...);
125 
129  virtual void info(const QString& message, ...);
130 
134  virtual void debug(const QString& message, ...);
135 
139  virtual void missingFile(const QString& nomFic);
140 
144  virtual void toDo(const QString& message);
145 
149  virtual void trace(const QString& message, ...);
150 
161  virtual void format(int level, const char* message, ...);
162 
165  void vformat(int level, const char* message, va_list args);
166 
179  virtual void output(const char* message, int level);
180 
184  static char* getStrDate();
185 
189 #ifdef _WIN32
190  static void checkFile(struct _finddata_t* c_file, time_t theTime);
191 #else
192  static void checkFile(const char* c_file, time_t theTime);
193 #endif
194 
195 protected:
199  virtual int initTrace();
200 
201  // Members
202 protected:
204  FILE* _ficTrace;
205 
206 private:
209 };
210 
211 #endif // TY_LOGGING
virtual void debug(const char *message,...)
Definition: logging.cpp:151
virtual void output(const char *message, int level)
Definition: logging.cpp:356
virtual void missingFile(const char *nomFic)
Definition: logging.cpp:162
static char * getStrDate()
Definition: logging.cpp:443
void vformat(int level, const char *message, va_list args)
Variable argument list version of format.
Definition: logging.cpp:313
virtual void warning(const char *message,...)
Definition: logging.cpp:119
virtual void error(const char *message,...)
Definition: logging.cpp:127
virtual ~OMessageManager()
Definition: logging.cpp:97
static LPOMessageManager _pInstance
Instance unique du singleton.
Definition: logging.h:208
virtual int initTrace()
Definition: logging.cpp:383
FILE * _ficTrace
Le fichier de trace.
Definition: logging.h:204
virtual void trace(const char *message,...)
Definition: logging.cpp:172
bool setAsSingleton()
Definition: logging.cpp:99
virtual void fatal(const char *message,...)
Definition: logging.cpp:135
static OMessageManager * get()
Definition: logging.cpp:108
virtual void format(int level, const char *message,...)
Definition: logging.cpp:305
static void checkFile(const char *c_file, time_t theTime)
Definition: logging.cpp:465
virtual void toDo(const char *message)
Definition: logging.cpp:167
virtual void info(const char *message,...)
Definition: logging.cpp:143
SmartPtr< OMessageManager > LPOMessageManager
Smart pointer sur OMessageManager.
Definition: logging.h:32