elog Namespace Reference

Typedefs

using callbackLog = std::function< void(const char *_libName, enum elog::level _level, int32_t _ligne, const char *_funcName, const char *_log)>
 

Enumerations

enum  level {
  level_print = -1, level_none = 0, level_critical = 1, level_error = 2,
  level_warning = 3, level_info = 4, level_debug = 5, level_verbose = 6
}
 

Functions

void init (int _argc, const char **_argv)
 
int32_t registerInstance (const std::string &_name)
 
void setLevel (const std::string &_name, enum elog::level _level)
 
void setLevel (int32_t _id, enum elog::level _level)
 
void setLevel (enum elog::level _level)
 
int32_t getLevel (int32_t _id)
 
std::vector< std::string > getListInstance ()
 
void setColor (bool _status)
 
void setTime (bool _status)
 
void setLine (bool _status)
 
void setFunction (bool _status)
 
void setThreadId (bool _status)
 
void setThreadNameEnable (bool _status)
 
void setLibName (bool _status)
 
void setBackTrace (bool _status)
 
void logChar (int32_t _id, int32_t _level, int32_t _ligne, const char *_funcName, const char *_log)
 
void logStream (int32_t _id, int32_t _level, int32_t _ligne, const char *_funcName, const std::ostream &_log)
 
void logChar1 (int32_t _id, int32_t _level, const char *_log)
 
void logStream1 (int32_t _id, int32_t _level, const std::ostream &_log)
 
void displayBacktrace (bool _breakAtEnd=false, int32_t _removeElement=0)
 
void setCallbackLog (const elog::callbackLog &_callback)
 
void setLogInFile (const std::string &_filename="")
 
void unsetLogInFile ()
 

Detailed Description

basic namespace of the elog library. (it might contain all the elog fuctions without macro)

Typedef Documentation

§ callbackLog

using elog::callbackLog = typedef std::function<void (const char* _libName, enum elog::level _level, int32_t _ligne, const char* _funcName, const char* _log)>

function definition of an external log function

Parameters
[in]_libNamepounter on a string containing the library name
[in]_levelLevel of the log (can be filter with setLevel)
[in]_ligneLine of the log
[in]_funcNameFull function name: 'void etk::MyClass::functionName(...)'
[in]_logString containing the Log

Enumeration Type Documentation

§ level

Log level is a simple list of all log availlable. This enum is used when setting a log and when user chose the level of log displayed.

Note
: I use a "enum" and not an "enum class" because it create some problem on the macro declaration (not easy to convert number in an "enum class"
Enumerator
level_print 

basic print for Help or result (never filtered)

level_none 

no display requested

level_critical 

Display only critical logs (note that critical generally assert with a backtrace (when we can))

level_error 

Display Error and critical logs.

level_warning 

Display log critical to warning.

level_info 

Display log critical to information (removed in release mode)

level_debug 

Display log critical to debug (removed in release mode)

level_verbose 

Display all logs (removed in release and debug mode)

Function Documentation

§ displayBacktrace()

void elog::displayBacktrace ( bool  _breakAtEnd = false,
int32_t  _removeElement = 0 
)

Display the current backtrace.

Parameters
[in]_breakAtEndassert program when backtrace is printed
[in]_removeElementNumber of element remove in the stack before display (permit to remove log function call)

§ getLevel()

int32_t elog::getLevel ( int32_t  _id)

Get the current level of debug for a specific intance.

Parameters
[in]_idId Of the intance
Returns
the enum casted in an integer ==> generise the API (not dependent of etk)

§ getListInstance()

std::vector<std::string> elog::getListInstance ( )

Get list of all intance.

Returns
the name list of all intance

§ init()

void elog::init ( int  _argc,
const char **  _argv 
)

Initialize elog.

Parameters
[in]_argcNumber of argument list
[in]_argvList of arguments

§ logChar()

void elog::logChar ( int32_t  _id,
int32_t  _level,
int32_t  _ligne,
const char *  _funcName,
const char *  _log 
)

Call log to display.

Parameters
[in]_idId of the instance type
[in]_levelLevel debug
[in]_ligneLine of the debug
[in]_funcNameFunction name for debug (compleate decorate signature)
[in]_logStream to log

§ logChar1()

void elog::logChar1 ( int32_t  _id,
int32_t  _level,
const char *  _log 
)

Call log to display.

Parameters
[in]_idId of the instance type
[in]_levelLevel debug
[in]_logStream to log

§ logStream()

void elog::logStream ( int32_t  _id,
int32_t  _level,
int32_t  _ligne,
const char *  _funcName,
const std::ostream &  _log 
)

Call log to display.

Parameters
[in]_idId of the instance type
[in]_levelLevel debug
[in]_ligneLine of the debug
[in]_funcNameFunction name for debug (compleate decorate signature)
[in]_logStream to log

§ logStream1()

void elog::logStream1 ( int32_t  _id,
int32_t  _level,
const std::ostream &  _log 
)

Call log to display.

Parameters
[in]_idId of the instance type
[in]_levelLevel debug
[in]_logStream to log

§ registerInstance()

int32_t elog::registerInstance ( const std::string &  _name)

Register an element in the log system.

Parameters
[in]_nameName of the module
Returns
reference Id of an instance name

§ setBackTrace()

void elog::setBackTrace ( bool  _status)

Set back-trace display on Error log enable or disable.

Parameters
[in]_statusNew value.

§ setCallbackLog()

void elog::setCallbackLog ( const elog::callbackLog _callback)

Set a callback to display all log in an other framework.

Parameters
[in]_callbackFunction to call when log arrive

§ setColor()

void elog::setColor ( bool  _status)

Set Color enable or disable.

Parameters
[in]_statusNew value of color.

§ setFunction()

void elog::setFunction ( bool  _status)

Set Function display enable or disable.

Parameters
[in]_statusNew value.

§ setLevel() [1/3]

void elog::setLevel ( const std::string &  _name,
enum elog::level  _level 
)

Set the log level of a specific instance.

Parameters
[in]_nameName of the intance
[in]_levelNew level to set on the instance

§ setLevel() [2/3]

void elog::setLevel ( int32_t  _id,
enum elog::level  _level 
)

Set the log level of a specific instance.

Parameters
[in]_idId of the intance
[in]_levelNew level to set on the instance

§ setLevel() [3/3]

void elog::setLevel ( enum elog::level  _level)

Set global debug level.

Parameters
[in]_levelNew level to set on the instance

§ setLibName()

void elog::setLibName ( bool  _status)

Set library display enable or disable.

Parameters
[in]_statusNew value.

§ setLine()

void elog::setLine ( bool  _status)

Set Line display enable or disable.

Parameters
[in]_statusNew value.

§ setLogInFile()

void elog::setLogInFile ( const std::string &  _filename = "")

Set log done in a specific file.

Parameters
[in]_filenameName of the file to log (if not set the log system select alone the log file)
Note
in release the log is automatically store in a file in the system. (windows log is done in file automatically)

§ setThreadId()

void elog::setThreadId ( bool  _status)

Set thread id enable or disable.

Parameters
[in]_statusNew value.

§ setThreadNameEnable()

void elog::setThreadNameEnable ( bool  _status)

Set thread name enable or disable.

Parameters
[in]_statusNew value.

§ setTime()

void elog::setTime ( bool  _status)

Set Time display enable or disable.

Parameters
[in]_statusNew value.

§ unsetLogInFile()

void elog::unsetLogInFile ( )

Disable log in a file.