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 | |
boolean | pruneESCSequences = true |
Public Fields inherited from TextLogger | |
AutoSizes | autoSizes = new AutoSizes() |
ObjectConverter | converter |
String | fmtMsgSuffix ="" |
String | fmtMultiLineMsgHeadline ="ALox: Multi line message follows: " |
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() |
Ticks | timeOfLastLog = new Ticks() |
Public Fields inherited from ThreadLock | |
int | recursionWarningThreshold = 10 |
int | waitWarningTimeLimitInMillis = 1000 |
Protected Methods | |
PlainTextLogger (String name, String typeName, boolean usesStdStreams) | |
abstract boolean | logSubstring (AString buffer, int start, int length) |
void | logText (Domain domain, Verbosity verbosity, AString msg, ScopeInfo scope, int lineNumber) |
abstract boolean | notifyLogOp (Phase phase) |
Protected Methods inherited from TextLogger | |
TextLogger (String name, String typeName, boolean usesStdStreams) | |
abstract void | notifyMultiLineOp (Phase phase) |
Protected Methods inherited from Logger | |
Logger (String name, String typeName) | |
Additional Inherited Members | |
Public Methods inherited from TextLogger | |
int | addAcquirer (ThreadLock newAcquirer) |
void | clearReplacements () |
void | log (Domain domain, Verbosity verbosity, ArrayList< Object > logables, ScopeInfo scope) |
int | removeAcquirer (ThreadLock acquirer) |
void | resetAutoSizes () |
void | setReplacement (String searched, String replacement) |
Public Methods inherited from Logger | |
String | getName () |
String | getTypeName () |
String | toString () |
Public Methods inherited from SmartLock | |
SmartLock () | |
int | cntAcquirers () |
Public Methods inherited from ThreadLock | |
ThreadLock () | |
ThreadLock (LockMode lockMode) | |
ThreadLock (LockMode lockMode, Safeness safeness) | |
void | acquire () |
int | dbgCountAcquirements (Thread thread) |
LockMode | getMode () |
Safeness | getSafeness () |
void | release () |
void | setSafeness (Safeness safeness) |
boolean | willRelease () |
Protected Fields inherited from TextLogger | |
AString | logBuf = new AString( 256 ) |
AString | msgBuf = new AString( 128 ) |
ArrayList< String > | replacements = new ArrayList<String>() |
int | stdStreamLockRegistrationCounter =0 |
boolean | usesStdStreams |
Protected Fields inherited from Logger | |
String | name |
String | typeName |
Protected Fields inherited from SmartLock | |
ArrayList< ThreadLock > | acquirers = new ArrayList<ThreadLock>() |
Protected Fields inherited from ThreadLock | |
int | cntAcquirements |
boolean | createOwnerStackTrace = false |
LockMode | lockMode |
Object | mutex |
Thread | owner |
Exception | ownerException |
Ticks | waitTime = new Ticks() |
Package Access Methods inherited from ThreadLock | |
void | constructor (LockMode lockMode, Safeness safeness) |
|
protected |
Creates a PlainTextLogger
|
abstractprotected |
Abstract method to be implemented by descendants. Has to write the given region of the given AString to the destination.
buffer | The string to write a portion of. |
start | The start of the portion in buffer to write out. |
length | The length of the portion in buffer to write out. |
false
is returned, the log line is aborted without an invocation of notifyLogOp(Phase.END). Reimplemented in TextFileLogger, ConsoleLogger, and MemoryLogger.
|
protected |
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:
domain | The Log Domain. |
verbosity | The verbosity. This has been checked to be active already on this stage and is provided to be able to be logged out only. |
msg | The log message. |
scope | Information about the scope of the Log Statement.. |
lineNumber | The line number of a multi-line message, starting with 0. For single line messages this is -1. |
Reimplemented from TextLogger.
|
abstractprotected |
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 to logSubstring returns false
, the second 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).
phase | Indicates the beginning or end of a log operation. |
false
is returned, the log line is aborted without an invocation of notifyLogOp(Phase.END). Reimplemented in TextFileLogger, ConsoleLogger, and MemoryLogger.
boolean 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.