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

Class Description


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"
 
SimpleDateFormat dateFormatter
 
AString format = new AString( "(%SF:%SL) %SM():%A5[%TC +%TL][%tN]%V[%D]%A1(%#): ")
 
int logNumberMinDigits = 3
 
Ticks maxElapsedTime = new Ticks(0)
 
String timeDiffDays = " days"
 
String timeDiffHours = " h"
 
String timeDiffMicros = " \u00B5s"
 
String timeDiffMillis = " ms"
 
long timeDiffMinimum = 1000L
 Minimum time difference to log in nanoseconds. Below that timeDiffNone is written.
 
String timeDiffMins = " m"
 
String timeDiffNanos = " ns"
 
String timeDiffNone = " 0 ns"
 Output for time difference if below reasonable (measurable) minimum defined in timeDiffMinimum.
 
String timeDiffSecs = " s"
 
String timeElapsedDays = " Days "
 
String timeOfDayFormat = "HH:mm:ss"
 
SimpleDateFormat timeOfDayFormatter
 
String verbosityError = "[ERR]"
 
String verbosityInfo = " "
 
String verbosityVerbose = "[***]"
 
String verbosityWarning = "[WRN]"
 

Protected Fields

boolean calInstanceSet
 
GregorianCalendar callerDateTimeCal = new GregorianCalendar()
 
Date callerDateTimeDate = new Date()
 
boolean dateInstanceSet
 
String defaultfmtDate = "yyyy-MM-dd"
 
String defaultfmtTimeOfDay = "HH:mm:ss"
 
TickSpan elapsed = new TickSpan()
 
Ticks elapsedTime = new Ticks(0)
 
FieldPosition fieldPositionZero = new FieldPosition( 0 )
 
int[] tempIntParameter = new int[1]
 
StringBuffer tempSBuf = new StringBuffer()
 
AString tmpAString = new AString()
 
Tokenizer tTok = new Tokenizer()
 Tokenizer used in write.
 
boolean warnedOnce = false
 

Protected Methods

void processVariable (TextLogger logger, Domain domain, Verbosity verbosity, ScopeInfo scope, AString dest, Substring variable)
 
void write (TextLogger logger, AString buf, Domain domain, Verbosity verbosity, ScopeInfo scope)
 
void writeTimeDiff (AString buf, long diffNanos)
 

Member Function Documentation

◆ processVariable()

void processVariable ( TextLogger  logger,
Domain  domain,
Verbosity  verbosity,
ScopeInfo  scope,
AString  dest,
Substring  variable 
)
protected

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.

Parameters
loggerThe logger that we are embedded in.
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.
scopeInformation about the scope of the Log Statement..
destThe buffer to write meta information into.
variableThe variable to read (may have more characters appended)

◆ write()

void write ( TextLogger  logger,
AString  buf,
Domain  domain,
Verbosity  verbosity,
ScopeInfo  scope 
)
protected

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.

Parameters
loggerThe logger that we are embedded in.
bufThe buffer to write meta information into.
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.
scopeInformation about the scope of the Log Statement..

◆ writeTimeDiff()

void writeTimeDiff ( AString  buf,
long  diffNanos 
)
protected

Helper function that logs a time given difference into the given buffer in a human readable format. Works from nano seconds to days.

Parameters
bufThe buffer to write the time difference representation into.
diffNanosThe time difference to write in nanoseconds.

Member Data Documentation

◆ calInstanceSet

boolean calInstanceSet
protected

Flag to indicate if calendar instance was set during one logText call

◆ callerDateTimeCal

GregorianCalendar callerDateTimeCal = new GregorianCalendar()
protected

Internal calendar object to get string representations of dates.

◆ callerDateTimeDate

Date callerDateTimeDate = new Date()
protected

Internal calendar object to get string representations of dates.

◆ dateFormat

String dateFormat = "yyyy-MM-dd"

Format string for the output of the log date. For more information about possible, see class java.text.SimpleDateFormat

◆ dateFormatter

SimpleDateFormat dateFormatter

Object to retrieve formatted log date. This field has to be set to null, when the field dateFormat gets modified and log operations have been scheduled since the creation of the Logger (respectively since the last change of that format).

◆ dateInstanceSet

boolean dateInstanceSet
protected

Flag to indicate if date instance was set during one logText call

◆ defaultfmtDate

String defaultfmtDate = "yyyy-MM-dd"
protected

Internal default string to detect default format for optimized format generation

◆ defaultfmtTimeOfDay

String defaultfmtTimeOfDay = "HH:mm:ss"
protected

Internal default string to detect default format for optimized format generation

◆ elapsed

TickSpan elapsed = new TickSpan()
protected

A reusable object for displaying the elapsed time span

◆ elapsedTime

Ticks elapsedTime = new Ticks(0)
protected

A reusable object for displaying the elapsed time

◆ fieldPositionZero

FieldPosition fieldPositionZero = new FieldPosition( 0 )
protected

Internal singleton to specify a first field in formatted output

◆ format

AString format = new AString( "(%SF:%SL) %SM():%A5[%TC +%TL][%tN]%V[%D]%A1(%#): ")

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

  • SF: The callers' source file name
  • SP: The callers' package name
  • SC: The callers' class name
  • SL: The line number in the callers' source file
  • SM: The method name
  • TD: The date the log call was invoked
  • TT: Time of day the log call was invoked
  • TC: Time elapsed since the Logger was created or its timer was reset
  • TL: Time elapsed since the last log call
  • tN: Thread name
  • tI: Thread ID
  • V: The verbosity. This is replaced by the corresponding strings found in fields verbosityError, verbosityWarning, verbosityInfo and verbosityVerbose.
  • D: Log domain
  • %#: The log call counter (like a line counter, but counting multi lines as one)
  • An: An auto-adjusted tabulator. This grows whenever it needs, but never shrinks. The optional integer number n specifies how much extra space is added when tab is adjusted. Setting this to a higher value avoids too many adjustments at the beginning of a log session.
  • LG: The name of the Logger. This might be useful if multiple loggers write to the same output stream (e.g. Console).
  • LX: The name of the Lox.
  • P: The name of the process / application.

Defaults to

"(%SF:%SL) %SM():%A5[%TC +%TL][%tN]%V[%D]%A1(%#): "

◆ logNumberMinDigits

int logNumberMinDigits = 3

Prefix for the domain.

◆ maxElapsedTime

Ticks maxElapsedTime = new Ticks(0)

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.

◆ tempIntParameter

int [] tempIntParameter = new int[1]
protected

Internal object to pass int parameters to methods that modify those

◆ tempSBuf

StringBuffer tempSBuf = new StringBuffer()
protected

Internal object to retrieve formatted time of day

◆ timeDiffDays

String timeDiffDays = " days"

Format for time difference outputs of more than a day.

◆ timeDiffHours

String timeDiffHours = " h"

Format for time difference outputs between 1h and 24h.

◆ timeDiffMicros

String timeDiffMicros = " \u00B5s"

Entity microseconds

◆ timeDiffMillis

String timeDiffMillis = " ms"

Entity milliseconds

◆ timeDiffMins

String timeDiffMins = " m"

Format for time difference outputs between 100s and 60 min.

◆ timeDiffNanos

String timeDiffNanos = " ns"

Entity milliseconds.

◆ timeDiffSecs

String timeDiffSecs = " s"

Format for time difference outputs between 10s and 99.9s.

◆ timeElapsedDays

String timeElapsedDays = " Days "

The word "Days" the out put of time elapsed (if longer than a day).

◆ timeOfDayFormat

String timeOfDayFormat = "HH:mm:ss"

Format string for the output of the time of day. For more information about possible, see class java.text.SimpleDateFormat

◆ timeOfDayFormatter

SimpleDateFormat timeOfDayFormatter

Object to retrieve formatted time of day. This field has to be set to null, when the field timeOfDayFormat gets modified and log operations have been scheduled since the creation of the Logger (respectively since the last change of that format).

◆ tmpAString

AString tmpAString = new AString()
protected

A reusable AString .

◆ verbosityError

String verbosityError = "[ERR]"

The replacement for variable %V in field format if Verbosity is ERROR

◆ verbosityInfo

String verbosityInfo = " "

The replacement for variable %V in field format if Verbosity is INFO

◆ verbosityVerbose

String verbosityVerbose = "[***]"

The replacement for variable %V in field format if Verbosity is VERBOSE

◆ verbosityWarning

String verbosityWarning = "[WRN]"

The replacement for variable %V in field format if Verbosity is WARNING

◆ warnedOnce

boolean warnedOnce = false
protected

Helper flag that indicates if a format warning report was already issued


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