RXtoRINEX  V2.1
RXtoRINEX provides tools to collect data from GPS / GNSS receivers in mobile devices, convert them to RINEX or RTK formats, and process RINEX files.
Public Types | Public Member Functions | List of all members
Logger Class Reference

#include <Logger.h>

Public Types

enum  logLevel {
  SEVERE =0, WARNING, INFO, CONFIG,
  FINE, FINER, FINEST
}
 The log levels defined in this class.
 

Public Member Functions

 Logger (string, string, string)
 
 Logger (string)
 
 Logger (void)
 
 ~Logger (void)
 
void setPrgName (string)
 
void setLevel (logLevel)
 
void setLevel (string)
 
bool isLevel (logLevel)
 
bool isLevel (string)
 
void severe (string)
 
void warning (string)
 
void info (string)
 
void config (string)
 
void fine (string)
 
void finer (string)
 
void finest (string)
 

Detailed Description

Logger class allows recording of tagged messages.

A program using Logger would perform the following steps:

  1. Define a Logger object stating the fileName of the logging file, or using the default stderr.
  2. State the desired log level. Can be SEVERE, WARNING, INFO, CONFIG, FINE, FINER or FINEST. If the log level is not explicitly stated, the default level is INFO.
  3. Log any message that would be necessary using the method corresponding to the desired log level of the message. Only those messages having level from SEVERE to the current level stated are recorded in the log file.

Constructor & Destructor Documentation

Logger::Logger ( string  fileName,
string  prefix,
string  initMsg 
)

Constructs a Logger using the given file name for recording messages, sets the logging message prefix, and prints the given initial message.

It opens a file with the given fileName, and sets the default log level to INFO. If the file exists, messages are appended at the end of the existing file. If it does not exist, it is created.

Parameters
fileNamethe name of the log file
prefixis a text to prefix logging messages (for exemple the name of the program, or an empty string)
initMsga text message to be logged when the logging object is created
Logger::Logger ( string  fileName)

Constructs a Logger using the given file name for recording messages.

It opens a file with the given fileName, and sets the default log level to INFO. If the file exists, further messages will be appended at the end of the existing file. If it does not exist, it is created.

Parameters
fileNamethe name of the log file
Logger::Logger ( void  )

Constructs a Logger using default parameters.

It set stderr as log file, and sets the default log level to INFO.

Logger::~Logger ( void  )

Destructs the Logger object after closing its log file.

Member Function Documentation

void Logger::config ( string  toLog)

config logs the message at CONFIG level. The message is appended to the log file if the current level is in the range SEVERE to CONFIG

Parameters
toLogthe message text to log
void Logger::fine ( string  toLog)

fine logs the message at FINE level. The message is appended to the log file if the current level is in the range SEVERE to FINE

Parameters
toLogthe message text to log
void Logger::finer ( string  toLog)

finer logs the message at FINER level. The message is appended to the log file if the current level is in the range SEVERE to FINER

Parameters
toLogthe message text to log
void Logger::finest ( string  toLog)

finest log the message at FINEST level. The message is appended to the log file if the current level is in the range SEVERE to FINEST

Parameters
toLogthe message text to log
void Logger::info ( string  toLog)

info logs message at INFO level. The message is appended to the log file if the current level is in the range SEVERE to INFO

Parameters
toLogthe message text to log
bool Logger::isLevel ( logLevel  level)

isLevel gives result of comparing the current log level with the level given.

Level can be SEVERE, WARNING, INFO, CONFIG, FINE, FINER or FINEST. The result of the comparison is true the given level is between SEVERE and the current level, that is messages at the given level would be actually recorded.

This methos is a way to know in advance if messages at the given level would be logged or not.

Parameters
levelthe log level to compare
Returns
true when messages at the given level would be logged, false otherwise.
bool Logger::isLevel ( string  levelDescription)

isLevel gives result of comparing the current log level with the level given.

Level is given as a string containing the word "S[EVERE]", "W[ARNING]", "I[NFO]", "C[ONFIG]", "[FIN]E", "[FINE]R" or "[FINES]T", which correspond with the log lavel having the same name. Note: characters between braces are optional.

Level characters can be in upper o lower case.

If the given level do not match with any of above stated words, it is assumed the default INFO log level.

The result of the comparison is true the given level is between SEVERE and the current level, that is messages at the given level would be actually recorded.

This methos is a way to know in advance if messages at the given level would be logged or not.

Parameters
levelDescriptionthe word describing the log level to set
void Logger::setLevel ( logLevel  level)

setLevel states the log level to be taken into account when logging messages.

Log level can be SEVERE, WARNING, INFO, CONFIG, FINE, FINER or FINEST. Only meesages having log level from SEVERE to setLevel will be actually recorded.

Parameters
levelthe log level to set
void Logger::setLevel ( string  levelDescription)

setLevel states the log level to be taken into account when logging messages.

Level is given as a string containing the word "S[EVERE]", "W[ARNING]", "I[NFO]", "C[ONFIG]", "[FIN]E", "[FINE]R" or "[FINES]T", which correspond with the log lavel having the same name. Note: characters between braces are optional.

Only meesages having log level from SEVERE to the level set will be actually recorded.

If level do not match with any of above stated words, the default INFO log level is set.

Level characters can be in upper o lower case.

Parameters
levelDescriptionthe word describing the log level to set
void Logger::setPrgName ( string  prefix)

setPrgName sets the prefix name to be used in message tagging

Parameters
prefixthe text to prefix messages (usually the program name)
void Logger::severe ( string  toLog)

severe logs a message at SEVERE level. All SEVERE messages are appended to the log file.

Parameters
toLogthe message text to log
void Logger::warning ( string  toLog)

warning logs a message at WARNING level. The message is appended to the log file if the current level is in the range SEVERE to WARNING

Parameters
toLogthe message text to log

The documentation for this class was generated from the following files: