ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::lox::detail::Logger Class Referenceabstract

Description:

This is a central class of the ALox logging implementation. It is not recommended to use this class directly for logging. Instead, use the simple and convenient static interface class Log or, for release logging and other more complex operations, use a Lox instance. The class is abstract. To implement an own log stream, derive a new Logger class and implement the abstract method Log.

Friends

class Lox

Definition at line 32 of file logger.inl.

Inheritance diagram for alib::lox::detail::Logger:
[legend]
Collaboration diagram for alib::lox::detail::Logger:
[legend]

Public Field Index:

integer CntLogs =0
 
time::Ticks TimeOfCreation
 The creation time of the Logger.
 
time::Ticks TimeOfLastLog
 Timestamp of the last log operation.
 
- Public Field Index: inherited from alib::threads::RecursiveLock
DbgLockAsserter Dbg
 The debug tool instance.
 

Public Method Index:

virtual ~Logger () override
 Destructs a logger.
 
const NStringGetName () const
 
const NStringGetTypeName () const
 
virtual void Log (Domain &dom, Verbosity verbosity, BoxesMA &logables, ScopeInfo &scope)=0
 
- Public Method Index: inherited from alib::threads::RecursiveLock
 ~RecursiveLock () override
 Destructor. With debug-compilations, asserts that this lock is not acquired.
 
ALIB_DLL void AcquireRecursive (ALIB_DBG_TAKE_CI)
 
virtual ALIB_DLL bool DCSIsAcquired () const override
 
virtual ALIB_DLL bool DCSIsSharedAcquired () const override
 
ALIB_DLL void ReleaseRecursive (ALIB_DBG_TAKE_CI)
 
ALIB_DLL bool TryAcquire (ALIB_DBG_TAKE_CI)
 
- Public Method Index: inherited from alib::lang::DbgCriticalSections::AssociatedLock
virtual ~AssociatedLock ()
 Virtual Destructor.
 

Protected Field Index:

NString32 Name
 
NString32 TypeName
 
- Protected Field Index: inherited from alib::threads::RecursiveLock
std::recursive_mutex mutex
 

Protected Method Index:

 Logger (const NString &name, const NString &typeName)
 
virtual void AcknowledgeLox (LoxImpl *lox, lang::ContainerOp op)
 

Field Details:

◆ CntLogs

integer alib::lox::detail::Logger::CntLogs =0

The number of logs actually performed so far. In a text logger this is similar to the line number, despite the fact that a single log call can produce more than one line.

Definition at line 63 of file logger.inl.

◆ Name

NString32 alib::lox::detail::Logger::Name
protected

The name of the Logger. Used as a reference to a logger. All loggers attached to a Lox have to differ in their names. If no name is specified with the constructor, the name will by the same as TypeName.

Definition at line 51 of file logger.inl.

◆ TimeOfCreation

time::Ticks alib::lox::detail::Logger::TimeOfCreation

The creation time of the Logger.

Definition at line 66 of file logger.inl.

◆ TimeOfLastLog

time::Ticks alib::lox::detail::Logger::TimeOfLastLog

Timestamp of the last log operation.

Definition at line 69 of file logger.inl.

◆ TypeName

NString32 alib::lox::detail::Logger::TypeName
protected

The type name of the Logger. This is set by the derived class similar to the class name.

Definition at line 55 of file logger.inl.

Constructor(s) / Destructor Details:

◆ Logger()

alib::lox::detail::Logger::Logger ( const NString & name,
const NString & typeName )
inlineprotected

Constructs a logger. This constructor is protected because this class is abstract.

Note: This constructor is implemented in the header and annotated as inline. This way, the Log::InitALox call receives the size of classes from the compilation unit that invokes the constructor. If different compile options are set, we have a chance to detect them here.

Parameters
nameThe name of the Logger. If empty, it defaults to the type name. Will be converted to upper case.
typeNameThe type of the Logger. Will be converted to upper case.

Definition at line 103 of file logger.inl.

◆ ~Logger()

virtual alib::lox::detail::Logger::~Logger ( )
inlineoverridevirtual

Destructs a logger.

Definition at line 119 of file logger.inl.

Method Details:

◆ AcknowledgeLox()

virtual void alib::lox::detail::Logger::AcknowledgeLox ( LoxImpl * lox,
lang::ContainerOp op )
inlineprotectedvirtual

This method is invoked by class Lox when a logger is added or removed from it. Note, that a logger might be added to multiple Lox objects in parallel.

The default implementation of this method is empty.

Parameters
loxThe Lox to acknowledge insertion or removal.
opThe operation. Either ContainerOp::Insert or ContainerOp::Remove.

Definition at line 135 of file logger.inl.

◆ GetName()

const NString & alib::lox::detail::Logger::GetName ( ) const
inline

Returns the name of this logger. The name has to be unique for all Loggers attached to a Lox.

Returns
The loggers name.

Definition at line 144 of file logger.inl.

◆ GetTypeName()

const NString & alib::lox::detail::Logger::GetTypeName ( ) const
inline

Returns the constant type name of this logger. The type name is defined by the class and hence provides a sort of run-time type information.

Returns
The loggers type name.

Definition at line 149 of file logger.inl.

◆ Log()

virtual void alib::lox::detail::Logger::Log ( Domain & dom,
Verbosity verbosity,
BoxesMA & logables,
ScopeInfo & scope )
pure virtual

This is the central method that derived logger classes have to implement to log a message. When it is invoked the Log Domain's Verbosity was already checked against parameter verbosity. The only action to take is to perform the log itself.
Parameter logables contains at least one object, the one provided with the log statement. Other objects that might be included in the list, are Prefix Objects corresponding to the scope.

Parameters
domThe Log Domain.
verbosityThe verbosity of the message.
logablesThe list of objects to log.
scopeInformation about the scope of the Log Statement..

Implemented in alib::lox::textlogger::TextLogger.


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