OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
VcstLogger.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: VcstLogger.h
4  *
5  * DESCRIPTION: provides logging capabilities for the runtime environment.
6  * Debug messages can be set to off, low, medium, or high and can be sent
7  * to the console or to a log file.
8  *
9  * Adapted directly from the IDPS file ProCmnLogger.h published
10  * by Raytheon Company.
11  *
12  **************************************************************************/
13 
14 #ifndef _VcstLogger_H_
15 #define _VcstLogger_H_
16 
17 #include <fstream>
18 #include <VcstTime.h>
19 
25 class VcstLogger {
26 public:
27 
31  enum Level {
32  DBG_OFF = 0, // Disable logging
33  DBG_HIGH, // Most basic details
34  DBG_MED, // Debugging level
35  DBG_LOW // Low-level detail
36  };
37 
41  enum LoggingDest {
43  };
44 
48  virtual ~VcstLogger();
49 
61  std::string processName, std::string path = ".");
62 
76  void init(std::string level, std::string dest, std::string processName,
77  std::string path = ".");
78 
83  static VcstLogger& getLogger();
84 
94  static VcstLogger* setLogger(VcstLogger* aLogger);
95 
102  static const char *errorAsStr(int status);
103 
110  static bool wasError(int status);
111 
117  bool isDebugHighEnabled();
118 
124  bool isDebugMedEnabled();
125 
131  bool isDebugLowEnabled();
132 
140  void debugHigh(std::string msg, const char* file, const int line);
141 
149  void debugMed(std::string msg, const char* file, const int line);
150 
158  void debugLow(std::string msg, const char* file, const int line);
159 
165  const char* file, const int line);
166 
172 
173 private:
174 
180  VcstLogger();
181 
187  VcstLogger(const VcstLogger &orig);
188 
194  VcstLogger &operator=(const VcstLogger &rhs);
195 
202  void initLogFile(const std::string& path, const std::string& processName);
203 
209  void getCurrentHRTime(std::ostringstream& inStream);
210 
215  VcstTime* timApi_;
216 
221  std::ostream* outStreamPtr_;
222 
226  std::ofstream logFile_;
227 
231  static VcstLogger* ourLogger_;
232 
236  VcstLogger::Level level_;
237 
242 
246  bool dbgHighEn_;
247 
251  bool dbgMedEn_;
252 
256  bool dbgLowEn_;
257 
261  static const std::string DEBUG_OFF_STRING;
262  static const std::string DEBUG_HIGH_STRING;
263  static const std::string DEBUG_MEDIUM_STRING;
264  static const std::string DEBUG_LOW_STRING;
265 
269  static const std::string DEST_STDOUT_STRING;
270  static const std::string DEST_LOGFILE_STRING;
271 };
272 
273 #define DEBUG_HIGH(logger, message) \
274  logger.debugHigh(message, __FILE__, __LINE__);
275 
276 #define DEBUG_MED(logger, message) \
277  logger.debugMed(message, __FILE__, __LINE__);
278 
279 #define DEBUG_LOW(logger, message) \
280  logger.debugLow(message, __FILE__, __LINE__);
281 
282 #endif
void log(std::string strLog, VcstLogger::Level level, std::string msg, const char *file, const int line)
int status
Definition: l1_czcs_hdf.c:32
bool isDebugMedEnabled()
@ string
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
Definition: HISTORY.txt:413
bool isDebugHighEnabled()
string path
Definition: color_dtdb.py:221
void debugMed(std::string msg, const char *file, const int line)
static VcstLogger & getLogger()
static VcstLogger * setLogger(VcstLogger *aLogger)
bool isDebugLowEnabled()
static bool wasError(int status)
void debugHigh(std::string msg, const char *file, const int line)
level
Definition: mapgen.py:186
bool isEnabledFor(VcstLogger::Level level)
void init(VcstLogger::Level level, VcstLogger::LoggingDest dest, std::string processName, std::string path=".")
string msg
Definition: mapgen.py:227
virtual ~VcstLogger()
static const char * errorAsStr(int status)
void debugLow(std::string msg, const char *file, const int line)