ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
MemoryLogger Class Reference

Description:

A logger that logs all messages to an in-memory buffer of type AString. The name of the Logger defaults to "MEMORY".

Definition at line 19 of file memorylogger.hpp.

#include <memorylogger.hpp>

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

Public Field Index:

AString MemoryLog
 
bool UseWStringLengthForTabAdjustments = true
 
- Public Field Index: inherited from PlainTextLogger
bool PruneESCSequences = true
 
- Public Field Index: inherited from TextLogger
ObjectConverterConverter = nullptr
 
TickConverter DateConverter
 
bool FormatWarningOnce = false
 
- Public Field Index: inherited from Logger
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 RecursiveLock
DbgLockAsserter Dbg
 The debug tool instance.
 

Public Method Index:

 MemoryLogger (const NString &name=nullptr, bool pruneESCSequences=true, bool useWStringLengthForTabAdjustments=true)
 
virtual ~MemoryLogger () override
 Destructs a MemoryLogger.
 
- Public Method Index: inherited from TextLogger
virtual ALIB_API ~TextLogger () override
 Destructs a TextLogger.
 
virtual ALIB_API void AcknowledgeLox (detail::LoxImpl *lox, lang::ContainerOp op) override
 
virtual ALIB_API void ClearReplacements ()
 Removes all pairs of searched strings and their replacement value.
 
FormatAutoSizesGetAutoSizes ()
 
FormatDateTimeGetFormatDate ()
 
FormatMetaInfoGetFormatMetaInfo ()
 
FormatMultiLineGetFormatMultiLine ()
 
FormatOtherGetFormatOther ()
 
FormatTimeDiffGetFormatTimeDiff ()
 
ReplacementsGetReplacements ()
 
virtual ALIB_API void Log (detail::Domain &domain, Verbosity verbosity, BoxesMA &logables, detail::ScopeInfo &scope) override
 
virtual ALIB_API void ResetAutoSizes ()
 
virtual ALIB_API void SetReplacement (const String &searched, const String &replacement)
 
- Public Method Index: inherited from Logger
virtual ~Logger () override
 Destructs a logger.
 
const NStringGetName () const
 
const NStringGetTypeName () const
 
- Public Method Index: inherited from RecursiveLock
 ~RecursiveLock () override
 Destructor. With debug-compilations, asserts that this lock is not acquired.
 
ALIB_API void AcquireRecursive (ALIB_DBG_TAKE_CI)
 
virtual ALIB_API bool DCSIsAcquired () const override
 
virtual ALIB_API bool DCSIsSharedAcquired () const override
 
ALIB_API void ReleaseRecursive (ALIB_DBG_TAKE_CI)
 
ALIB_API bool TryAcquire (ALIB_DBG_TAKE_CI)
 
- Public Method Index: inherited from DbgCriticalSections::AssociatedLock
virtual ~AssociatedLock ()
 Virtual Destructor.
 

Protected Method Index:

virtual integer logSubstring (const String &buffer, integer start, integer length) override
 
virtual bool notifyLogOp (lang::Phase phase) override
 
virtual void notifyMultiLineOp (lang::Phase) override
 Empty implementation, not needed for this class.
 
- Protected Method Index: inherited from PlainTextLogger
 PlainTextLogger (const NString &name, const NString &typeName, bool pUsesStdStreams)
 
virtual ~PlainTextLogger () override
 Destructs a MemoryLogger.
 
virtual ALIB_API void logText (detail::Domain &domain, Verbosity verbosity, AString &msg, detail::ScopeInfo &scope, int lineNumber) override
 
- Protected Method Index: inherited from TextLogger
ALIB_API TextLogger (const NString &pName, const NString &typeName, bool pUsesStdStreams)
 
virtual ALIB_API void processVariable (const NString &domainPath, Verbosity verbosity, detail::ScopeInfo &scope, AString &dest, Substring &variable)
 
virtual ALIB_API void writeMetaInfo (AString &buffer, detail::Domain &domain, Verbosity verbosity, detail::ScopeInfo &scope)
 
virtual ALIB_API void writeTimeDiff (AString &buffer, int64_t diffNanos)
 
- Protected Method Index: inherited from Logger
 Logger (const NString &name, const NString &typeName)
 

Additional Inherited Members

- Protected Field Index: inherited from TextLogger
lang::system::CalendarDateTime callerDateTime
 
AString logBuf
 The internal log Buffer.
 
AString msgBuf
 The buffers for converting the logables.
 
bool usesStdStreams
 
Variable varFormatAutoSizes
 
Variable varFormatDateTime
 
Variable varFormatMetaInfo
 
Variable varFormatMultiLine
 
Variable varFormatOther
 
Variable varFormatTimeDiff
 
Variable varReplacements
 
- Protected Field Index: inherited from Logger
NString32 Name
 
NString32 TypeName
 
- Protected Field Index: inherited from RecursiveLock
std::recursive_mutex mutex
 

Field Details:

◆ MemoryLog

AString MemoryLog

The logging Buffer. This can be accessed publicly and hence used as preferred. Especially, the whole log can easily be cleared using AString::Reset. In multithreaded environments, Lox interface's mutex should be acquired before accessing this buffer. The initial size of the buffer is 8kb.

Definition at line 30 of file memorylogger.hpp.

◆ UseWStringLengthForTabAdjustments

bool UseWStringLengthForTabAdjustments = true

If this field is set to true (which is the default), the effective length of the messages when converted to wide character strings are taken into account.

Switching this off increases the overall logging performance (especially when logging into memory) significantly.

Definition at line 37 of file memorylogger.hpp.

Constructor(s) / Destructor Details:

◆ MemoryLogger()

MemoryLogger ( const NString & name = nullptr,
bool pruneESCSequences = true,
bool useWStringLengthForTabAdjustments = true )
inlineexplicit

Creates a MemoryLogger with the given name.

Parameters
name(Optional) The name of the Logger. Defaults to "MEMORY".
pruneESCSequences(Optional) Sets the member PruneESCSequences. Defaults to true.
useWStringLengthForTabAdjustments(Optional) Sets the member UseWStringLengthForTabAdjustments. Defaults to true.

Definition at line 53 of file memorylogger.hpp.

Here is the call graph for this function:

◆ ~MemoryLogger()

virtual ~MemoryLogger ( )
inlineoverridevirtual

Destructs a MemoryLogger.

Definition at line 67 of file memorylogger.hpp.

Method Details:

◆ logSubstring()

virtual integer logSubstring ( const String & buffer,
integer start,
integer length )
inlineoverrideprotectedvirtual

Write the given region of the given AString to the destination buffer.

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 95 of file memorylogger.hpp.

Here is the call graph for this function:

◆ notifyLogOp()

virtual bool notifyLogOp ( lang::Phase phase)
inlineoverrideprotectedvirtual

Start a new 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 79 of file memorylogger.hpp.

Here is the call graph for this function:

◆ notifyMultiLineOp()

virtual void notifyMultiLineOp ( lang::Phase )
inlineoverrideprotectedvirtual

Empty implementation, not needed for this class.

Implements TextLogger.

Definition at line 107 of file memorylogger.hpp.


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