OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022

#include <VcstLogger.h>

Public Types

enum  Level { DBG_OFF = 0, DBG_HIGH, DBG_MED, DBG_LOW }
 
enum  LoggingDest { STDOUT = 0, LOGFILE }
 

Public Member Functions

virtual ~VcstLogger ()
 
void init (VcstLogger::Level level, VcstLogger::LoggingDest dest, std::string processName, std::string path=".")
 
void init (std::string level, std::string dest, std::string processName, std::string path=".")
 
bool isDebugHighEnabled ()
 
bool isDebugMedEnabled ()
 
bool isDebugLowEnabled ()
 
void debugHigh (std::string msg, const char *file, const int line)
 
void debugMed (std::string msg, const char *file, const int line)
 
void debugLow (std::string msg, const char *file, const int line)
 
void log (std::string strLog, VcstLogger::Level level, std::string msg, const char *file, const int line)
 
bool isEnabledFor (VcstLogger::Level level)
 

Static Public Member Functions

static VcstLoggergetLogger ()
 
static VcstLoggersetLogger (VcstLogger *aLogger)
 
static const char * errorAsStr (int status)
 
static bool wasError (int status)
 

Detailed Description

This class provides logging capabilities for the ADL environment. Debug messages can be set to off, low, medium, or high and can be sent to the console or to a log file.

Definition at line 25 of file VcstLogger.h.

Member Enumeration Documentation

◆ Level

enum Level

Logger detail levels.

Enumerator
DBG_OFF 
DBG_HIGH 
DBG_MED 
DBG_LOW 

Definition at line 42 of file VcstLogger.h.

◆ LoggingDest

Logger destination.

Enumerator
STDOUT 
LOGFILE 

Definition at line 52 of file VcstLogger.h.

Constructor & Destructor Documentation

◆ ~VcstLogger()

virtual ~VcstLogger ( )
virtual

Destructor

Member Function Documentation

◆ debugHigh()

void debugHigh ( std::string  msg,
const char *  file,
const int  line 
)

Logs a HIGH debug message.

Parameters
msgThe debug message to send.
fileThe name of the file this message was sent from.
lineThe line number this message was sent from.

◆ debugLow()

void debugLow ( std::string  msg,
const char *  file,
const int  line 
)

Logs a LOW debug message.

Parameters
msgThe debug message to send.
fileThe name of the file this message was sent from.
lineThe line number this message was sent from.

◆ debugMed()

void debugMed ( std::string  msg,
const char *  file,
const int  line 
)

Logs a MED debug message.

Parameters
msgThe debug message to send.
fileThe name of the file this message was sent from.
lineThe line number this message was sent from.

◆ errorAsStr()

static const char* errorAsStr ( int  status)
static

Translate a return error number into a string.

Parameters
status,oneof PRO_FAIL, PRO_SUCCESS, ... (see Typedefs.h>
Return values
stringrepresentation of the error code.

◆ getLogger()

static VcstLogger& getLogger ( )
static

Get visibility to the reference to the INF logging service implementation.

◆ init() [1/2]

void init ( std::string  level,
std::string  dest,
std::string  processName,
std::string  path = "." 
)

Initialize my logger. Sets the logging detail level retrieved from the algorithm execution XML file.

This init method calls the version of init which takes enum values to do the actual initialization.

Parameters
levelA string value representing the log level.
destA string value representing the message destination (STDOUT or a log file).
processNameThe name of the executable that is running.
pathThe path where the log file will be written.

◆ init() [2/2]

void init ( VcstLogger::Level  level,
VcstLogger::LoggingDest  dest,
std::string  processName,
std::string  path = "." 
)

Initialize my logger. Sets the logging detail level retrieved from the algorithm execution XML file.

Parameters
levelAn enum value representing the log level.
destAn enum value representing the message destination (STDOUT or a log file).
processNameThe name of the executable that is running.
pathThe path where the log file will be written.

◆ isDebugHighEnabled()

bool isDebugHighEnabled ( )

Returns whether or not DBG_HIGH is enabled.

Return values
trueif DBG_HIGH is enabled.

◆ isDebugLowEnabled()

bool isDebugLowEnabled ( )

Returns whether or not DBG_LOW is enabled.

Return values
trueif DBG_LOW is enabled.

◆ isDebugMedEnabled()

bool isDebugMedEnabled ( )

Returns whether or not DBG_MED is enabled.

Return values
trueif DBG_MED is enabled.

◆ isEnabledFor()

bool isEnabledFor ( VcstLogger::Level  level)

Returns whether or not level is enabled

◆ log()

void log ( std::string  strLog,
VcstLogger::Level  level,
std::string  msg,
const char *  file,
const int  line 
)

Logs a debug message.

◆ setLogger()

static VcstLogger* setLogger ( VcstLogger aLogger)
static

Setter for our logger instance. My implementation of the VcstLoggerGCIF interface method.

Parameters
aLoggerA new logger instance. My garbage collector deletes this memory.
Return values
Theold logger instance. My caller is responsible for deleting this memory.

◆ wasError()

static bool wasError ( int  status)
static

Determine if a given error level is an error case or not.

Parameters
status,oneof PRO_FAIL, PRO_SUCCESS, ... (see Typedefs.h>
Return values
falseif the error was PRO_SUCCESS, else return false.

The documentation for this class was generated from the following file:
  • /gfs-oceanweb/web/ocssw/ocssw_src/include/ViirsCmn/VcstLogger.h