Visual Computing Library
|
The AbstractLogger class is used as common ancestor class for all the logger types in the library. More...
#include <vclib/misc/logger/abstract_logger.h>
Public Types | |
enum | LogLevel { ERROR_LOG = 0 , WARNING_LOG , MESSAGE_LOG , PROGRESS_LOG , DEBUG_LOG } |
Public Member Functions | |
virtual void | enableIndentation ()=0 |
virtual void | disableIndentation ()=0 |
virtual void | enablePrintPercentage ()=0 |
virtual void | disablePrintPercentage ()=0 |
virtual void | setPrintLevel (LogLevel level)=0 |
Sets the maximum print level of the logger. | |
virtual void | enablePrintMessageDuringProgress ()=0 |
virtual void | disablePrintMessageDuringProgress ()=0 |
virtual void | enablePrintTimer ()=0 |
virtual void | disablePrintTimer ()=0 |
virtual void | reset ()=0 |
virtual void | setMaxLineWidth (uint width)=0 |
virtual void | startTimer ()=0 |
virtual void | stopTimer ()=0 |
virtual double | time () const =0 |
Returns the time passed since the last call to startTimer member function, or the time passed between the call to startTimer and the call to stopTimer member functions. The time is expressed in seconds. | |
virtual void | startNewTask (double fromPerc, double toPerc, const std::string &action)=0 |
virtual void | endTask (const std::string &action)=0 |
virtual double | percentage () const =0 |
virtual void | setPercentage (uint newPerc)=0 |
virtual void | log (const std::string &msg) const =0 |
Prints a message to the logger, with level LogLevel::PROGRESS and without modifying the current percentage. | |
virtual void | log (const std::string &msg, LogLevel lvl) const =0 |
Prints a message to the logger, with the given level and without modifying the current percentage. | |
virtual void | log (uint perc, const std::string &msg)=0 |
Prints a message to the logger, with the level LogLevel::PROGRESS and with the given percentage. | |
virtual void | log (uint perc, const std::string &msg, LogLevel lvl)=0 |
Prints a message to the logger, with the given level and with the given percentage. | |
virtual void | startProgress (const std::string &msg, uint progressSize, uint percPrintProgress=10, uint startPerc=0, uint endPerc=100)=0 |
Allows to easily manage progresses with the logger, along with the progress and endProgress member functions. | |
virtual void | endProgress ()=0 |
Allows to easily manage progresses with the logger, along with the startProgress and progress member functions. | |
virtual void | progress (uint n)=0 |
Allows to easily manage progresses with the logger, along with the startProgress and endProgress member functions. | |
The AbstractLogger class is used as common ancestor class for all the logger types in the library.
Allows to easily manage progresses with the logger, along with the startProgress
and progress
member functions.
This logger functionality should be used when processing a loop having a fixed size, with regular prints of the progress.
This member function ends the current progress.
The typical usage is the following:
Implemented in vcl::Logger< Stream >, vcl::Logger< QTextStream >, and vcl::NullLogger.
Prints a message to the logger, with level LogLevel::PROGRESS
and without modifying the current percentage.
[in] | msg | The message to print. |
Implemented in vcl::NullLogger, vcl::Logger< Stream >, and vcl::Logger< QTextStream >.
Prints a message to the logger, with the given level and without modifying the current percentage.
[in] | msg | The message to print. |
[in] | lvl | The level of the message. |
Implemented in vcl::NullLogger, vcl::Logger< Stream >, and vcl::Logger< QTextStream >.
Prints a message to the logger, with the level LogLevel::PROGRESS
and with the given percentage.
[in] | perc | The percentage of the progress. |
[in] | msg | The message to print. |
Implemented in vcl::Logger< Stream >, vcl::Logger< QTextStream >, and vcl::NullLogger.
|
pure virtual |
Prints a message to the logger, with the given level and with the given percentage.
[in] | perc | The percentage of the progress. |
[in] | msg | The message to print. |
[in] | lvl | The level of the message. |
Implemented in vcl::Logger< Stream >, vcl::Logger< QTextStream >, and vcl::NullLogger.
Allows to easily manage progresses with the logger, along with the startProgress
and endProgress
member functions.
This logger functionality should be used when processing a loop having a fixed size, with regular prints of the progress.
This member functions increments the current progress. Only if the current percentage reaches a new step percentage (set in the startProgress
member function), a message will be printed by the logger.
The typical usage is the following:
[in] | n | iteration number of the current progress. It must be less than the progressSize argument of the startProgress member function. |
Implemented in vcl::Logger< Stream >, vcl::Logger< QTextStream >, and vcl::NullLogger.
Sets the maximum print level of the logger.
Only messages with a level less or equal to the given level will be printed. For example, if the level is set to LogLevel::MESSAGE
, only messages with level LogLevel::ERROR
, LogLevel::WARNING
and LogLevel::MESSAGE
will be printed.
LogLevel::PROGRESS
.[in] | level | The maximum print level of the logger. |
Implemented in vcl::Logger< Stream >, vcl::Logger< QTextStream >, and vcl::NullLogger.
|
pure virtual |
Allows to easily manage progresses with the logger, along with the progress
and endProgress
member functions.
This logger functionality should be used when processing a loop having a fixed size, with regular prints of the progress.
This member function starts a new progress. With the default arguments, will print a message from 0% to 100%, every 10%.
The typical usage is the following:
[in] | msg | the message that will be printed during the progress |
[in] | progressSize | the number of iterations made during the progress |
[in] | percPrintProgress | interval of percentage on which print a progress message, default 10% |
[in] | startPerc | start percentage of the progress, default 0% |
[in] | endPerc | end percentage of the progress, default 100% |
Implemented in vcl::NullLogger, vcl::Logger< Stream >, and vcl::Logger< QTextStream >.
Returns the time passed since the last call to startTimer
member function, or the time passed between the call to startTimer
and the call to stopTimer
member functions. The time is expressed in seconds.
Implemented in vcl::Logger< Stream >, vcl::Logger< QTextStream >, and vcl::NullLogger.