This is a very simple file logger for textual log outputs. The file name string provided in the constructor is not verified. The fileName may be changed any time by simply setting the public member FileName without the need of any other interaction other than acquiring the Lox
that this logger is attached to.
Public Fields | |
String | FileName |
bool | hasIoError =false |
![]() | |
bool | PruneESCSequences = true |
![]() | |
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 |
![]() | |
int | CntLogs |
Ticks | TimeOfCreation = new Ticks() |
The creation time of the Logger. | |
Ticks | TimeOfLastLog = new Ticks() |
Timestamp of the last log operation. | |
![]() | |
int | RecursionWarningThreshold =10 |
int | waitWarningTimeLimitInMillis =1000 |
Public Methods | |
TextFileLogger (String fileName, String loggerName=null) | |
![]() | |
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) |
![]() | |
String | GetName () |
String | GetTypeName () |
override String | ToString () |
![]() | |
SmartLock () | |
int | CntAcquirers () |
![]() | |
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 | |
bool | currentlyInMultiLineOp |
StreamWriter | sw |
![]() | |
AString | logBuf =new AString( 256 ) |
AString | msgBuf =new AString( 128 ) |
List< String > | replacements =new List<String>() |
int | stdStreamLockRegistrationCounter =0 |
bool | usesStdStreams |
![]() | |
String | Name |
String | TypeName |
![]() | |
List< ThreadLock > | acquirers =new List<ThreadLock>() |
![]() | |
int | cntAcquirements |
LockMode | lockMode |
Object | mutex |
Thread | owner |
Ticks | waitTime =new Ticks() |
Protected Methods | |
void | closeFile () |
override bool | logSubstring (AString buffer, int start, int length) |
override bool | notifyLogOp (Phase phase) |
override void | notifyMultiLineOp (Phase phase) |
void | openFile () |
![]() | |
PlainTextLogger (String name, String typeName, bool usesStdStreams) | |
override void | logText (Domain domain, Verbosity verbosity, AString msg, ScopeInfo scope, int lineNumber) |
![]() | |
TextLogger (String name, String typeName, bool usesStdStreams) | |
![]() | |
Logger (String name, String typeName) | |
|
inline |
Creates a TextFileLogger.
fileName | The filename (potentially including a path) of the output log file. |
loggerName | The name of the Logger. Defaults to "TEXTFILE". |
|
inlineprotected |
Closes the file.
|
inlineprotectedvirtual |
Write the given region of the given AString to the destination buffer.
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. |
true
if OK). Implements PlainTextLogger.
|
inlineprotectedvirtual |
Start a new log line. Appends a new-line character sequence to previously logged lines.
phase | Indicates the beginning or end of a log operation. |
true
if OK). Implements PlainTextLogger.
|
inlineprotectedvirtual |
Implementation of abstract interface signaling start and end of a multi line message. On start signal, the log file is opened, closed otherwise. Also stores the actual multi line message state in a field. This is for logText() to know whether file is to be opened/closed.
phase | Indicates the beginning or end of a multi-line operation. |
Implements TextLogger.
|
inlineprotected |
Opens the file.
|
protected |
Flag to prevent file open/close operations when multi line text logging is performed.
String FileName |
The path and fileName to the log file.
bool hasIoError =false |
Flag that indicates if there was an error opening he file
|
protected |
Used to write into a log file.