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.
|
#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) |
Logger class allows recording of tagged messages.
A program using Logger would perform the following steps:
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.
fileName | the name of the log file |
prefix | is a text to prefix logging messages (for exemple the name of the program, or an empty string) |
initMsg | a 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.
fileName | the 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.
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
toLog | the 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
toLog | the 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
toLog | the 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
toLog | the 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
toLog | the 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.
level | the log level to compare |
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.
levelDescription | the 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.
level | the 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.
levelDescription | the word describing the log level to set |
void Logger::setPrgName | ( | string | prefix | ) |
setPrgName sets the prefix name to be used in message tagging
prefix | the 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.
toLog | the 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
toLog | the message text to log |