EventAnalysis
1.3.0
|
#include <iomanip>
#include <iostream>
Go to the source code of this file.
Namespaces | |
EA | |
IncludeFileExc.h IncludeFileExc class declaration. | |
EA::SmartLog | |
Macros | |
#define | COUT(level) |
#define | CCOUT(level) |
Smart log utility which prints no header at the beginning of the line. More... | |
#define | ENDL std::endl |
Enumerations | |
enum | EA::SmartLog::VerboseLevel { EA::SmartLog::VerboseLevel::SILENT = 0, EA::SmartLog::VerboseLevel::ERROR = 1, EA::SmartLog::VerboseLevel::WARNING = 2, EA::SmartLog::VerboseLevel::INFO = 3, EA::SmartLog::VerboseLevel::DEBUG = 4, EA::SmartLog::VerboseLevel::DEEPDEB = 5 } |
Functions | |
bool | EA::SmartLog::operator> (const VerboseLevel &vl1, const VerboseLevel &vl2) |
std::string | EA::SmartLog::Format (const std::string &str, size_t maxLength) |
Format a string so that its length is less or equal to maxLength. More... | |
void | EA::SmartLog::MuteOutput () |
Mutes the console output. More... | |
void | EA::SmartLog::UnmuteOutput () |
Unmutes the console output. More... | |
Variables | |
const char * | EA::SmartLog::levelNames [6] = {"", "ERROR", "WARNING", "", "DEBUG", "DEEPDEB"} |
Name of verbosity levels, which will be printed on stdout at each call of COUT. More... | |
VerboseLevel | EA::SmartLog::verboseLevel = VerboseLevel::INFO |
The maximum desired verbosity. More... | |
int | EA::SmartLog::maxRoutineNameLength = 30 |
The maximum length for the printed routine name. More... | |
Some utilities for logs with support for different verbosity levels.
#define CCOUT | ( | level | ) |
Smart log utility which prints no header at the beginning of the line.
This macro is useful to continue the output of the standard COUT on subsequent lines without repeating the header at each line. For example:
static const std::string routineName("dummyFunction"); COUT(ERROR) << "Error reasons:" << ENDL; CCOUT(ERROR) << "- Reason 1" << ENDL; CCOUT(ERROR) << "- Reason 2" << ENDL;
will print:
[dummyFunction] ERROR Error reasons:
#define COUT | ( | level | ) |
Smart log function. It writes on stdout only if the specified verbosity level is lesser than the maximum one (SmartLog::verboseLevel).
It requires to define a routineName string variable inside every context from which it is called. For example:
void dummyFunction{ static const std::string routineName("dummyFunction") COUT(ERROR) << "This is an error message." << ENDL;}
will print:
[dummyFunction] ERROR This is an error message.
only if SmartLog::verboseLevel has been set to ERROR or higher.
#define ENDL std::endl |
Alias for std::endl.