Carna  Version 3.3.2
Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
Carna::base::Log Class Reference

Records log messages. The log writing is delegated to implementations of the Log::Writer interface. The default writer is an instance from Log::StdWriter class. More...

#include <Log.h>

+ Inheritance diagram for Carna::base::Log:
+ Collaboration diagram for Carna::base::Log:

Classes

class  OnShutdownListener
 Defines callback interface that is invoked when the Log system is about to shut down. More...
 
class  StdWriter
 Writes fatal and error classified log messages to std::cerr and such classified as warning or debug to std::cout. More...
 
struct  TagScope
 Enforces the log to use a specific tag for the duration of the existence of the object from this class. The CARNA_LOG_TAG_SCOPE macro is provided for convenience. More...
 
class  TextWriter
 Abstract implementation of the Writer interface, that formats log messages along with their severity as pure ASCII character chains. More...
 
class  Writer
 Writes log entries. More...
 

Public Types

enum  Severity {
  fatal, error, warning, debug,
  verbose
}
 Describes the severity of a log entry. More...
 
- Public Types inherited from Carna::base::Singleton< Log >
typedef Log Instance
 Denotes the class, that is derived from this class template.
 

Public Member Functions

virtual ~Log ()
 Deletes. Notifies its shutdown listeners if they haven't been notified yet.
 
const std::string & tag () const
 Tells current log tag.
 
void setWriter (Writer *)
 Sets object that log writing will be delegated to.
 
void record (Severity severity, const std::string &entry) const
 Instructs current writer to write entry with severity.
 
void addOnShutdownListener (OnShutdownListener &listener)
 Makes listener be notified when the log system is about to shut down.
 
void removeOnShutdownListener (const OnShutdownListener &listener)
 Makes listener no longer be notified when the log system is about to shut down.
 
void shutdown ()
 Notifies the shutdown listeners that the log system is about to shut down, if they haven't been notified yet. Usually there should be no necessity to call this method, unless the current writer is becoming invalid. No further messages will be logged.
 
- Public Member Functions inherited from Carna::base::Singleton< Log >
virtual ~Singleton ()
 Denotes that the instance was deleted.
 

Protected Member Functions

 Log ()
 Instantiates.
 
- Protected Member Functions inherited from Carna::base::Singleton< Log >
 Singleton ()
 Denotes that the instance was created. Default constructor is hidden.
 

Friends

class Singleton< Log >
 

Additional Inherited Members

- Static Public Member Functions inherited from Carna::base::Singleton< Log >
static Loginstance ()
 Returns the only instance from class InstanceType.
 
static bool exists ()
 Tells whether the instance from class InstanceType currently exists.
 
- Static Protected Member Functions inherited from Carna::base::Singleton< Log >
static void reset ()
 Deletes the only instance from class InstanceType.
 

Detailed Description

Records log messages. The log writing is delegated to implementations of the Log::Writer interface. The default writer is an instance from Log::StdWriter class.

Date
22.2.15 - 6.4.15
Author
Leonid Kostrykin

Definition at line 46 of file Log.h.

Member Enumeration Documentation

◆ Severity

Describes the severity of a log entry.

Enumerator
fatal 

Indicates errors that might lead to misbehaving program logic.

error 

Indicates errors like memory leaks.

warning 

Indicates warnings.

debug 

Indicates messages that might be of interest when searching bugs.

verbose 

Indicates statistics and suchlike.

Definition at line 83 of file Log.h.


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