OSFI-C++  3.9.2
OpenSF Integration Library
Logger.h
1 /*
2  * openSF Integration Libraries (OSFI)
3  * Deimos Space, S.L.U.
4  *
5  * This file is part of OSFI. OSFI is free software; you can redistribute it
6  * and/or modify it under the terms of the 'ESA Software Community Licence Permissive' as
7  * published by the European Space Agency; either version 2.4 of the License,
8  * or (at your option) any later version. You should have received a
9  * copy of the 'ESA Software Community Licence Permissive - v2.4' along with this program
10  * or one can be found at <http://eop-cfi.esa.int/index.php/docs-and-mission-data/licensing-documents>.
11  *
12  * @file
13  * @brief OSFI-C++ header that provides formatted logging facilities.
14  */
15 
16 #ifndef _LOGGER_
17 #define _LOGGER_
18 
19 #include <string>
20 #include <iostream>
21 
22 using namespace std;
23 
24 #if __cplusplus >= 201103L
25 
26  #define OSFI_NO_RETURN [[noreturn]]
27 #else
28  #define OSFI_NO_RETURN /* nothing */
29 #endif
30 
64 class Logger
65 {
66 public:
67 
72  static void error(const string& message);
73 
78  static void warning(const string& message);
79 
84  static void info(const string& message);
85 
93  static void debug(const string& message);
94 
99  static ostream & getErrorStream();
100 
107  static ostream & getDebugStream();
108 
113  static ostream & getInfoStream();
114 
119  static ostream & getWarningStream();
120 
126  static void progress(int step, int nSteps);
127 
133  OSFI_NO_RETURN static void finishExecution(int errorCode);
134 
140  static void qualityReport(const string& name, double value);
141 
147  static void qualityReport(const string& name, const string& value);
148 
153  static ostream & getQualityStream();
154 
158  bool static isDebugging();
159 
169  bool static isColored();
170 
171 private:
172 
176  static bool debugging;
177 
181  static bool colored;
182 
186  static const char delimitier;
187 
191  static const char * fileName;
192 
193 };
194 
195 #endif // _LOGGER_
Logger
Definition: Logger.h:64