This class is a sort of plug-in for the TextLogger class. Its purpose is to assemble the meta information of each log line (things like timestamps, thread information, verbosity and domain, etc.).
To manipulate the meta information log output, three options exist:
Public Fields | |
String | DateFormat = "yyyy-MM-dd" |
AString | Format = new AString( "%SF(%SL):%A5%SM() %A5[%TC +%TL][%tN]%V[%D]%A1(%#): " ) |
int | LogNumberMinDigits = 3 |
Prefix for the domain. | |
Ticks | MaxElapsedTime = new Ticks(0) |
AString | NoMethodInfo = new AString( "---" ) |
Replacement string if no source info is available. | |
AString | NoSourceFileInfo = new AString( "---" ) |
Replacement string if no source info is available. | |
String | TimeDiffDays = " days" |
Format for time difference outputs of more than a day. | |
String | TimeDiffHours = " h" |
Format for time difference outputs between 1h and 24h. | |
String | TimeDiffMicros = " \u00B5s" |
Entity microseconds for time difference outputs below 1000 microseconds. | |
String | TimeDiffMillis = " ms" |
Entity milliseconds for time difference outputs below 1000 milliseconds. | |
long | TimeDiffMinimum = 1000L |
Minimum time difference to log in nanoseconds. Below that TimeDiffNone is written. | |
String | TimeDiffMins = " m" |
Format for time difference outputs between 100s and 60 min. | |
String | TimeDiffNanos = " ns" |
Entity nanoseconds for time difference outputs below 1000 microseconds. | |
String | TimeDiffNone = " 0 ns" |
Output for time difference if below reasonable (measurable) minimum defined in TimeDiffMinimum. | |
String | TimeDiffSecs = " s" |
Format for time difference outputs between 10s and 99.9s. | |
String | TimeElapsedDays = " Days " |
The word "Days" the out put of time elapsed (if longer than a day). | |
String | TimeOfDayFormat = "HH:mm:ss" |
String | VerbosityError = "[ERR]" |
String | VerbosityInfo = " " |
String | VerbosityVerbose = "[***]" |
String | VerbosityWarning = "[WRN]" |
Public Methods | |
virtual void | Write (TextLogger logger, AString buffer, Domain domain, Verbosity verbosity, ScopeInfo scope) |
Protected Fields | |
DateTime? | callerDateTime |
A singleton DateTime object shared between different format variables during one invocation. | |
String | dateFormatString |
The .Net format string built at runtime to {0:FmtDate}. | |
String | detectDateFormatChanges |
Reference to last date format string to detect changes at runtime. | |
String | detectTimeOfDayFormatChanges |
Reference to last time of day format string to detect changes at runtime. | |
Ticks | elapsedTime =new Ticks(0) |
StringBuilder | formatSB = new StringBuilder( 64 ) |
Internal string builder used for formatting operations. | |
String | timeOfDayFormatString |
The .Net format string built at runtime to {0:FmtTimeOfDay}. | |
AString | tmpAString =new AString() |
Tokenizer | tTok =new Tokenizer() |
Tokenizer used in Write. | |
bool | warnedOnce = false |
Protected Methods | |
virtual void | processVariable (TextLogger logger, Domain domain, Verbosity verbosity, ScopeInfo scope, AString dest, Substring variable) |
virtual void | writeTimeDiff (AString buf, long diffNanos) |
|
inlineprotectedvirtual |
Processes the next command found in the format string, by writing formatted information into the given buffer. The given Substring holds the next command. When method returns, the command is cut from the front.
logger | The logger that we are embedded in. |
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. |
scope | Information about the scope of the Log Statement.. |
dest | The buffer to write meta information into. |
variable | The variable to read (may have more characters appended) |
|
inlinevirtual |
Parses the Format string and logs meta information into the log buffer. For each variable found, method processVariable is invoked. Hence, to add new variables, the latter method can be overwritten by descendants. Overwriting this method is recommended for formatter classes that do not rely on format strings.
logger | The logger that we are embedded in. |
buffer | The buffer to write meta information into. |
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. |
scope | Information about the scope of the Log Statement.. |
|
inlineprotectedvirtual |
Helper function that logs a time given difference into the given buffer in a human readable format. Works from micro seconds to days.
buf | The buffer to write the time difference representation into. |
diffNanos | The time difference to write in nanoseconds. |
String DateFormat = "yyyy-MM-dd" |
Format string for the output of the log date. For more information, see "Standard Date and Time Format Strings" in .NET StringBuilder.AppendFormat()
The line format specifies the (automated) log output that is prepended to each log line before the log message itself.
The string supports replacement variables that begin with a % sign
Defaults to
The maximum time elapsed. Used to determine the width of the output when writing the elapsed time.
This field will be read from the configuration variable ALOX_LOGGERNAME_MAX_ELAPSED_TIME when the TextLogger that this object belongs to is attached to a Lox and written back on removal.
String TimeOfDayFormat = "HH:mm:ss" |
Format string for the output of the time of day. For more information, see "Standard Date and Time Format Strings" in .NET StringBuilder.AppendFormat()
String VerbosityError = "[ERR]" |
The replacement for variable %V
in field Format if Verbosity is Error
String VerbosityInfo = " " |
The replacement for variable %V
in field Format if Verbosity is Info
String VerbosityVerbose = "[***]" |
The replacement for variable %V
in field Format if Verbosity is Verbose
String VerbosityWarning = "[WRN]" |
The replacement for variable %V
in field Format if Verbosity is Warning
|
protected |
Helper flag that indicates if a format warning report was already issued