ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | Protected Fields | Protected Methods | List of all members
ConsoleLogger Class Reference

#include <consolelogger.hpp>

Inheritance diagram for ConsoleLogger:
[legend]
Collaboration diagram for ConsoleLogger:
[legend]

Class Description


A logger that logs all messages to the standard output cout. The name of the Logger defaults to "CONSOLE".

ALox text logger escape sequences (see class ESC) are removed and ignored.

Definition at line 37 of file consolelogger.hpp.

Public Methods

 ConsoleLogger (const NString &name=nullptr)
 
virtual ~ConsoleLogger () override
 
- Public Methods inherited from TextLogger
virtual ALIB_API ~TextLogger () override
 
virtual ALIB_API void AcknowledgeLox (LoxImpl *lox, ContainerOp op) override
 
virtual ALIB_API void ClearReplacements ()
 
virtual ALIB_API void Log (Domain &domain, Verbosity verbosity, Boxes &logables, ScopeInfo &scope) override
 
virtual ALIB_API void ResetAutoSizes ()
 
virtual ALIB_API void SetReplacement (const String &searched, const String &replacement)
 
- Public Methods inherited from Logger
virtual ~Logger ()
 
const NStringGetName () const
 
const NStringGetTypeName () const
 
- Public Methods inherited from SmartLock
 SmartLock ()
 
void Acquire (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc)
 
ALIB_API int AddAcquirer (ThreadLock *newAcquirer)
 
ALIB_API int CntAcquirers ()
 
ALIB_API void Release ()
 defined(ALIB_DOX) More...
 
ALIB_API int RemoveAcquirer (ThreadLock *acquirer)
 
- Public Methods inherited from ThreadLock
ALIB_API ThreadLock (Safeness safeness=Safeness::Safe)
 
ALIB_API ~ThreadLock ()
 
ALIB_API void Acquire (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc)
 
int CountAcquirements () const
 
ThreadGetOwner () const
 
Safeness GetSafeness () const
 
bool IsOwnedByCurrentThread () const
 
ALIB_API void Release ()
 defined(ALIB_DOX) More...
 
ALIB_API void SetSafeness (Safeness safeness)
 
bool WillRelease () const
 

Protected Fields

StringWriter writer
 
- Protected Fields inherited from TextLogger
AString logBuf
 
AString msgBuf
 
std::vector< AStringreplacements
 
int stdStreamLockRegistrationCounter =0
 
bool usesStdStreams
 
- Protected Fields inherited from Logger
NString32 Name
 
NString32 TypeName
 
- Protected Fields inherited from SmartLock
std::vector< ThreadLock * > acquirers
 
ThreadLockNR lock
 
- Protected Fields inherited from ThreadLock
uint16_t cntAcquirements =0
 
std::mutex mutex
 
std::condition_variable mutexNotifier
 
std::thread::id owner
 
Safeness safeness
 

Protected Methods

virtual ALIB_API integer logSubstring (const String &buffer, integer start, integer length) override
 
virtual ALIB_API bool notifyLogOp (Phase phase) override
 
virtual void notifyMultiLineOp (Phase) override
 
- Protected Methods inherited from PlainTextLogger
 PlainTextLogger (const NString &name, const NString &typeName, bool pUsesStdStreams)
 
virtual ~PlainTextLogger () override
 
virtual ALIB_API void logText (detail::Domain &domain, Verbosity verbosity, AString &msg, detail::ScopeInfo &scope, int lineNumber) override
 
- Protected Methods inherited from TextLogger
ALIB_API TextLogger (const NString &pName, const NString &typeName, bool pUsesStdStreams)
 
- Protected Methods inherited from Logger
 Logger (const NString &name, const NString &typeName)
 

Additional Inherited Members

- Public Types inherited from TextLogger
enum  LightColorUsage { Auto, Never, Foreground, Background }
 
- Public Static Fields inherited from SmartLock
static ALIB_API SmartLock StdOutputStreams
 
- Public Fields inherited from PlainTextLogger
bool PruneESCSequences = true
 
- Public Fields inherited from TextLogger
lib::strings::util::AutoSizes AutoSizes
 
ObjectConverterConverter = nullptr
 
String16 FmtMsgSuffix
 
String64 FmtMultiLineMsgHeadline = A_CHAR("ALox: Multi line message follows: ")
 
String16 FmtMultiLinePrefix = A_CHAR(">> ")
 
String16 FmtMultiLineSuffix = A_CHAR("")
 
textlogger::MetaInfoMetaInfo
 
AString MultiLineDelimiter
 
String16 MultiLineDelimiterRepl = A_CHAR("\\r")
 
int MultiLineMsgMode =2
 
- Public Fields inherited from Logger
integer CntLogs =0
 
lib::time::Ticks TimeOfCreation
 
lib::time::Ticks TimeOfLastLog
 
- Public Fields inherited from ThreadLock
NCString DbgOwnerFile =nullptr
 
NCString DbgOwnerFunc =nullptr
 
int DbgOwnerLine
 
uint16_t DbgRecursionWarningThreshold =10
 
integer DbgWarningAfterWaitTimeInMillis =2000L
 

Constructor & Destructor Documentation

◆ ConsoleLogger()

ConsoleLogger ( const NString name = nullptr)
inlineexplicit

Creates a ConsoleLogger.

Parameters
name(Optional) The name of the Logger, defaults to "CONSOLE".

Definition at line 51 of file consolelogger.hpp.

◆ ~ConsoleLogger()

virtual ~ConsoleLogger ( )
inlineoverridevirtual

Destructs a ConsoleLogger

Definition at line 59 of file consolelogger.hpp.

Member Function Documentation

◆ logSubstring()

aworx::integer logSubstring ( const String buffer,
integer  start,
integer  length 
)
overrideprotectedvirtual

Writes the given region of the given string to the console.

Parameters
bufferThe string to write a portion of.
startThe start of the portion in buffer to write out.
lengthThe length of the portion in buffer to write out.
Returns
The number of characters written, -1 on error.

Implements PlainTextLogger.

Definition at line 25 of file consolelogger.cpp.

Here is the call graph for this function:

◆ notifyLogOp()

bool notifyLogOp ( Phase  phase)
overrideprotectedvirtual

Starts/ends log line. Appends a new-line character sequence to previously logged lines.

Parameters
phaseIndicates the beginning or end of a log line.
Returns
Always returns true.

Implements PlainTextLogger.

Definition at line 18 of file consolelogger.cpp.

◆ notifyMultiLineOp()

virtual void notifyMultiLineOp ( Phase  )
inlineoverrideprotectedvirtual

Empty implementation, not needed for this class

Implements TextLogger.

Definition at line 90 of file consolelogger.hpp.

Member Data Documentation

◆ writer

StringWriter writer
protected

The encapsulated output stream.

Definition at line 41 of file consolelogger.hpp.


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