EventAnalysis  1.3.0
Classes | Enumerations | Functions | Variables
EA::SmartLog Namespace Reference

Classes

class  FilesProxy
 

Enumerations

enum  VerboseLevel {
  VerboseLevel::SILENT = 0, VerboseLevel::ERROR = 1, VerboseLevel::WARNING = 2, VerboseLevel::INFO = 3,
  VerboseLevel::DEBUG = 4, VerboseLevel::DEEPDEB = 5
}
 

Functions

bool operator> (const VerboseLevel &vl1, const VerboseLevel &vl2)
 
std::string Format (const std::string &str, size_t maxLength)
 Format a string so that its length is less or equal to maxLength. More...
 
void MuteOutput ()
 Mutes the console output. More...
 
void UnmuteOutput ()
 Unmutes the console output. More...
 

Variables

const char * levelNames [6] = {"", "ERROR", "WARNING", "", "DEBUG", "DEEPDEB"}
 Name of verbosity levels, which will be printed on stdout at each call of COUT. More...
 
VerboseLevel verboseLevel = VerboseLevel::INFO
 The maximum desired verbosity. More...
 
int maxRoutineNameLength = 30
 The maximum length for the printed routine name. More...
 
FILE * stdoutSave = NULL
 
FILE * stderrSave = NULL
 
std::streambuf * cout_sbuf = NULL
 
std::streambuf * cerr_sbuf = NULL
 
FilesProxy muteFiles
 
bool isMuted = false
 

Enumeration Type Documentation

◆ VerboseLevel

Enumerator
SILENT 
ERROR 
WARNING 
INFO 
DEBUG 
DEEPDEB 

Function Documentation

◆ Format()

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.

If the string is longer than maxLength it will be trimmed down. For example, if str="dummyString" and maxLength=9 the returned string will be "dummyS...".

Parameters
strThe string to be formatted.
maxLengthThe maximum length of the formatted string.
Returns
a formatted string whose length is less than or equal to maxLength.

◆ MuteOutput()

void EA::SmartLog::MuteOutput ( )

Mutes the console output.

This method redirects the output of std::cout and std::cerr to /dev/null, avoiding any message to be printed on the console. Use UnmuteOutput to unmute the console.

◆ operator>()

bool EA::SmartLog::operator> ( const VerboseLevel vl1,
const VerboseLevel vl2 
)
inline

◆ UnmuteOutput()

void EA::SmartLog::UnmuteOutput ( )

Unmutes the console output.

This method cancels the effects of MuteOutput.

Variable Documentation

◆ cerr_sbuf

std::streambuf* EA::SmartLog::cerr_sbuf = NULL

◆ cout_sbuf

std::streambuf* EA::SmartLog::cout_sbuf = NULL

◆ isMuted

bool EA::SmartLog::isMuted = false

◆ levelNames

const char * EA::SmartLog::levelNames = {"", "ERROR", "WARNING", "", "DEBUG", "DEEPDEB"}

Name of verbosity levels, which will be printed on stdout at each call of COUT.

◆ maxRoutineNameLength

int EA::SmartLog::maxRoutineNameLength = 30

The maximum length for the printed routine name.

◆ muteFiles

FilesProxy EA::SmartLog::muteFiles

◆ stderrSave

FILE* EA::SmartLog::stderrSave = NULL

◆ stdoutSave

FILE* EA::SmartLog::stdoutSave = NULL

◆ verboseLevel

VerboseLevel EA::SmartLog::verboseLevel = VerboseLevel::INFO

The maximum desired verbosity.