ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Fields | Protected Methods | List of all members
PlainTextLogger Class Referenceabstract
Inheritance diagram for PlainTextLogger:
[legend]
Collaboration diagram for PlainTextLogger:
[legend]

Class Description


A text logger that either removes or ignores (just writes through) ALox ESC sequences. Implements abstract method logText and introduces two new abstract methods logSubstring and notifyLogOp.

Public Fields

bool PruneESCSequences = true
 
- Public Fields inherited from TextLogger
AutoSizes AutoSizes = new AutoSizes()
 
ObjectConverter Converter
 
String FmtMsgSuffix =""
 
String FmtMultiLineMsgHeadline ="ALox: Multi line message follows: "
 Headline for multi line messages (depending on MultiLineMsgMode).
 
String FmtMultiLinePrefix =">> "
 
String FmtMultiLineSuffix =null
 
MetaInfo MetaInfo =new MetaInfo()
 
String MultiLineDelimiter =null
 
String MultiLineDelimiterRepl ="\\r"
 
int MultiLineMsgMode =2
 
- Public Fields inherited from Logger
int CntLogs
 
Ticks TimeOfCreation = new Ticks()
 The creation time of the Logger.
 
Ticks TimeOfLastLog = new Ticks()
 Timestamp of the last log operation.
 
- Public Fields inherited from ThreadLock
int RecursionWarningThreshold =10
 
int waitWarningTimeLimitInMillis =1000
 

Protected Methods

 PlainTextLogger (String name, String typeName, bool usesStdStreams)
 
abstract bool logSubstring (AString buffer, int start, int length)
 
override void logText (Domain domain, Verbosity verbosity, AString msg, ScopeInfo scope, int lineNumber)
 
abstract bool notifyLogOp (Phase phase)
 
- Protected Methods inherited from TextLogger
 TextLogger (String name, String typeName, bool usesStdStreams)
 
abstract void notifyMultiLineOp (Phase phase)
 
- Protected Methods inherited from Logger
 Logger (String name, String typeName)
 

Additional Inherited Members

- Public Methods inherited from TextLogger
override int AddAcquirer (ThreadLock newAcquirer)
 
void ClearReplacements ()
 
override void Log (Domain domain, Verbosity verbosity, List< Object > logables, ScopeInfo scope)
 
override int RemoveAcquirer (ThreadLock acquirer)
 
void ResetAutoSizes ()
 
void SetReplacement (String searched, String replacement)
 
- Public Methods inherited from Logger
String GetName ()
 
String GetTypeName ()
 
override String ToString ()
 
- Public Methods inherited from SmartLock
 SmartLock ()
 
int CntAcquirers ()
 
- Public Methods inherited from ThreadLock
 ThreadLock (LockMode lockMode=LockMode.Recursive, Safeness safeness=Safeness.Safe)
 
virtual void Acquire ([CallerLineNumber] int cln=0,[CallerFilePath] String csf="",[CallerMemberName] String cmn="")
 
int DbgCountAcquirements (Thread thread=null)
 
LockMode GetMode ()
 
Safeness GetSafeness ()
 
virtual void Release ()
 
void SetSafeness (Safeness safeness)
 
override String ToString ()
 
bool WillRelease ()
 
- Protected Fields inherited from TextLogger
AString logBuf =new AString( 256 )
 
AString msgBuf =new AString( 128 )
 
List< String > replacements =new List<String>()
 
int stdStreamLockRegistrationCounter =0
 
bool usesStdStreams
 
- Protected Fields inherited from Logger
String Name
 
String TypeName
 
- Protected Fields inherited from SmartLock
List< ThreadLockacquirers =new List<ThreadLock>()
 
- Protected Fields inherited from ThreadLock
int cntAcquirements
 
LockMode lockMode
 
Object mutex
 
Thread owner
 
Ticks waitTime =new Ticks()
 

Constructor & Destructor Documentation

◆ PlainTextLogger()

PlainTextLogger ( String  name,
String  typeName,
bool  usesStdStreams 
)
inlineprotected

Creates a PlainTextLogger

Parameters
nameThe name of the Logger. If empty, it defaults to the type name.
typeNameThe type of the Logger.
usesStdStreamsDenotes whether this logger writes to the standard output streams.

Member Function Documentation

◆ logSubstring()

abstract bool logSubstring ( AString  buffer,
int  start,
int  length 
)
protectedpure virtual

Abstract method to be implemented by descendants. Has to write the given region of the given AString to the destination.

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
If false is returned, the log line is aborted without an invocation of notifyLogOp(Phase.End).

Implemented in TextFileLogger, CLRDebuggerLogger, ConsoleLogger, and MemoryLogger.

◆ logText()

override void logText ( Domain  domain,
Verbosity  verbosity,
AString  msg,
ScopeInfo  scope,
int  lineNumber 
)
inlineprotectedvirtual

The implementation of the abstract method of parent class TextLogger. Loops over the log text, removes or ignores ESC sequences (all but ESC.TAB) and invokes abstract methods of descendants as follows:

Parameters
domainThe Log Domain.
verbosityThe verbosity. This has been checked to be active already on this stage and is provided to be able to be logged out only.
msgThe log message.
scopeInformation about the scope of the Log Statement..
lineNumberThe line number of a multi-line message, starting with 0. For single line messages this is -1.

Implements TextLogger.

◆ notifyLogOp()

abstract bool notifyLogOp ( Phase  phase)
protectedpure virtual

Abstract method to be implemented by descendants. This method is called when a new log message is started. It is called exactly once before a series of logSubstring() calls and exactly once after such series. If either the start or one of the calls logSubstring returns false, the invocation that would indicate the end of a log message is omitted.

Implementing this method allows the acquisition of system resources (e.g. opening a file).

Parameters
phaseIndicates the beginning or end of a log operation.
Returns
If false is returned, the log line is aborted without an invocation of notifyLogOp(Phase.End).

Implemented in TextFileLogger, CLRDebuggerLogger, ConsoleLogger, and MemoryLogger.

Member Data Documentation

◆ PruneESCSequences

bool PruneESCSequences = true

If this field is set to true (the default), all ESC color and style codes get removed when logging into this Logger. ESC.TAB is processed.

It might be useful, to set this to false, e.g. in the case, the contents of the Logger is (later) written into a different logger (e.g. as a multi line message) which is capable of interpreting the escape sequences of class ESC.


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