Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Logger Class Reference

LogSourc e is the means for a function or any program segment to "connect" to a Log. More...

#include <Log.h>

Inheritance diagram for Logger:
Inheritance graph
[legend]
Collaboration diagram for Logger:
Collaboration graph
[legend]

Public Types

typedef Log::level_t level_t
 
typedef void * oper
 

Public Member Functions

template<typename ... TT>
 Logger (const char *filename, const TT &...args)
 Start logging,. More...
 
template<typename ... TT>
 Logger (Log &log, const char *filename, const TT &...args)
 Start logging,. More...
 
bool isLevel (level_t l)
 Returns true, if the log monitor level is at least l. More...
 
bool isDebug (level_t l=0)
 Returns true, if the debug level of the monitor is at least l. More...
 
template<int L, typename ... TT>
Loggerstart (const TT &... args)
 General.
 
template<typename ... TT>
Loggerquit (const TT &... args)
 Quits immediately, dumps pending messages.
 
template<typename ... TT>
Loggeralert (const TT &... args)
 Quits immediately, dumps pending messages.
 
template<typename ... TT>
Loggercritical (const TT &... args)
 Quits immediately, dumps pending messages.
 
template<typename ... TT>
Loggererror (const TT &... args)
 Echoes.
 
template<typename ... TT>
Loggerwarn (const TT &... args)
 Possible error, but execution can continue.
 
template<int L = LOG_WARNING, typename ... TT>
Loggerdiscouraged (const TT &... args)
 Warning on user's convention or action that can potentially cause errors or confusions.
 
template<int L = LOG_WARNING, typename ... TT>
Loggerfail (const TT &... args)
 Possible error, but execution can continue. Special type of Logger::warn().
 
template<int L = LOG_WARNING, typename ... TT>
Loggerobsolete (const TT &... args)
 Feature has been removed. Special type of Logger::warn(). More...
 
template<int L = LOG_WARNING, typename ... TT>
Loggerattention (const TT &... args)
 Possible error, but execution can continue. Special type of Logger::warn().
 
template<typename ... TT>
Loggernote (const TT &... args)
 For top-level information.
 
template<int L = LOG_NOTICE, typename ... TT>
Loggersuspicious (const TT &... args)
 A weak warning about something going possibly wrong.
 
template<int L = LOG_NOTICE, typename ... TT>
Loggerunimplemented (const TT &... args)
 Feature to be done. Special type of Logger::note(). More...
 
template<int L = LOG_NOTICE, typename ... TT>
Loggerdeprecating (const TT &... args)
 Feature will be removed. Special type of Logger::note(). More...
 
template<int L = LOG_NOTICE, typename ... TT>
Loggerspecial (const TT &... args)
 Other useful information.
 
template<int L = LOG_NOTICE, typename ... TT>
Loggerexperimental (const TT &... args)
 
template<int L = LOG_NOTICE, typename ... TT>
Loggeradvice (const TT &... args)
 
template<typename ... TT>
Loggerinfo (const TT &... args)
 
template<int L = LOG_INFO, typename ... TT>
Loggerok (const TT &... args)
 
template<int L = LOG_INFO, typename ... TT>
Loggeraccept (const TT &... args)
 Some input has been accepted, for example by a syntax.
 
template<int L = LOG_INFO, typename ... TT>
Loggerpending (const TT &... args)
 Report a conditional accept/reject, to be completed next. More...
 
template<int L = LOG_INFO, typename ... TT>
Loggerreject (const TT &... args)
 Some input has been rejected, for example by a syntax. More...
 
template<int L = LOG_INFO, typename ... TT>
Loggersuccess (const TT &... args)
 Some processing step has completed with desired result.
 
template<int L = LOG_INFO, typename ... TT>
Loggerhint (const TT &... args)
 Like advice, but weaker.
 
template<int L = LOG_INFO, typename ... TT>
Loggerrevised (const TT &... args)
 
template<typename ... TT>
Loggerdebug (const TT &... args)
 Public, yet typically used "internally", when TIMING=true. More...
 
template<typename ... TT>
Loggerdebug2 (const TT &... args)
 Debug information.
 
template<typename ... TT>
Loggerdebug3 (const TT &... args)
 
Loggerlog (level_t level)
 
template<typename ... TT>
Loggeroperator() (const TT &... args)
 
void startTiming ()
 Send a short [INFO] preceded with a time stamp. More...
 
template<typename ... TT>
void startTiming (const TT &... args)
 
void endTiming ()
 
Loggeroperator<< (const std::ostream &sstr)
 Send a longer [INFO] preceded with a time stamp. More...
 
template<class T >
Loggeroperator<< (const T &x)
 
void end ()
 
Loggeroperator<< (oper op)
 Handling flush operator.
 
Loggeroperator<< (const Logger &l)
 NEW: sending "mout" insread of "mout.endl" Handling flush operator.
 
int getVerbosity () const
 
template<>
void append (const TextStyle::Colour &colour)
 
- Public Member Functions inherited from StreamBuilder< 0 >
 StreamBuilder (const TT &... args)
 
StreamBuildercreate (const TT &... args)
 
StreamBuilderadd (const T &arg, const TT &... args)
 

Public Attributes

bool timing
 

Static Public Attributes

static bool TIMING = false
 
static char MARKER = '@'
 
static oper endl
 

Protected Member Functions

template<typename ... TT>
void initTiming (const TT &... args)
 
template<typename T , typename ... TT>
void describeTiming (const T &arg, const TT &... args)
 
void describeTiming ()
 
template<typename ... TT>
void setPrefix (const char *filename, const TT &... args)
 Sets a label that starts every line in the log. More...
 
void appendPrefix (std::stringstream &sstr)
 
template<typename T , typename ... TT>
void appendPrefix (std::stringstream &sstr, const T &arg, const TT &... args)
 
template<level_t L>
LoggerinitMessage (const Notification &notif)
 
LoggerinitMessage (level_t level)
 Picks message label from a dictionary.
 
template<typename T , typename ... TT>
Loggerflush (const T &arg, const TT &... rest)
 
template<typename T >
Loggerflush (const T &arg)
 
Loggerflush ()
 
template<typename T >
void append (const T &arg)
 
- Protected Member Functions inherited from StreamBuilder< 0 >
StreamBuilderadd ()
 

Protected Attributes

Logmonitor
 
std::string prefix
 
level_t level
 
time_t time
 
const Notificationnotif_ptr
 

Detailed Description

LogSourc e is the means for a function or any program segment to "connect" to a Log.

Examples
Castable-example.cpp, and ReferenceMap-example.cpp.

Constructor & Destructor Documentation

◆ Logger() [1/2]

Logger ( const char *  filename,
const TT &...  args 
)

Start logging,.

Parameters
funcName- name of the finction, often assigned as standard C macro FUNCTION .
name- specifier of the source, file name for example (to be basenamed).

◆ Logger() [2/2]

Logger ( Log log,
const char *  filename,
const TT &...  args 
)

Start logging,.

Parameters
funcName- name of the finction, often assigned as standard C macro FUNCTION .
name- specifier of the source, file name for example (to be basenamed).

Member Function Documentation

◆ debug()

Logger& debug ( const TT &...  args)
inline

Public, yet typically used "internally", when TIMING=true.

Debug information. Internally, this value is added to LOG_DEBUG.

  • LOG_DEBUG + 0 - print general debugging information
    • LOG_DEBUG + 1 - print names for top-level functions entered
    • LOG_DEBUG + 5 - print names for functions entered
    • LOG_DEBUG + 5 - include time toOStr
    • 10 - save results as files
    • 15 - save intermediate results as files
    • 20 - dump mass data (eg. coordinates during an image traversal)
Examples
ReferenceMap-example.cpp.

◆ deprecating()

Logger& deprecating ( const TT &...  args)
inline

Feature will be removed. Special type of Logger::note().

See also
Logger::obsolete().

◆ isDebug()

bool isDebug ( level_t  l = 0)
inline

Returns true, if the debug level of the monitor is at least l.

Compares the argument to the threshold of the receiving Log monitor, not to the current level of this logger.

◆ isLevel()

bool isLevel ( level_t  l)
inline

Returns true, if the log monitor level is at least l.

Compares the argument to the threshold of the receiving Log monitor, not to the current level of this logger.

◆ obsolete()

Logger& obsolete ( const TT &...  args)
inline

Feature has been removed. Special type of Logger::warn().

See also
Logger::deprecating().

◆ operator<<()

Logger& operator<< ( const std::ostream &  sstr)
inline

Send a longer [INFO] preceded with a time stamp.

Direct

◆ pending()

Logger& pending ( const TT &...  args)
inline

Report a conditional accept/reject, to be completed next.

This message can be sent for example before continuing a further, confirmative check.

◆ reject()

Logger& reject ( const TT &...  args)
inline

Some input has been rejected, for example by a syntax.

This message does not indicate error.

◆ setPrefix()

void setPrefix ( const char *  filename,
const TT &...  args 
)
inlineprotected

Sets a label that starts every line in the log.

\param name - explicitly given classname like "Composite" or __FILE__
\param name - __FILE__

void setPrefixOLD(const char *functionName, const char * name);

Parameters
filename– as returned by built-in macro FILE
func_name– as returned by built-in macro FUNCTION

TODO:

Parameters
func_params– optional function and template parameters, formulated by the user.

Start from s2, because dir may contain '.'

◆ startTiming() [1/2]

void startTiming ( )
inline

Send a short [INFO] preceded with a time stamp.

Starts, if global TIMING flag is set and my flag unset.

◆ startTiming() [2/2]

void startTiming ( const TT &...  args)
inline

Starts, if global TIMING flag is set and my flag unset.

◆ unimplemented()

Logger& unimplemented ( const TT &...  args)
inline

Feature to be done. Special type of Logger::note().

See also
Logger::obsolete().

The documentation for this class was generated from the following files: