Class AbsoluteTimeDateFormatter
- Namespace
- log4net.DateFormatter
- Assembly
- log4net.dll
Formats a DateTime as "HH:mm:ss,fff".
public class AbsoluteTimeDateFormatter : IDateFormatter
- Inheritance
-
AbsoluteTimeDateFormatter
- Implements
- Derived
- Inherited Members
Remarks
Formats a DateTime in the format "HH:mm:ss,fff" for example, "15:49:37,459".
Constructors
AbsoluteTimeDateFormatter()
public AbsoluteTimeDateFormatter()
Fields
AbsoluteTimeDateFormat
String constant used to specify AbsoluteTimeDateFormat in layouts. Current value is ABSOLUTE.
public const string AbsoluteTimeDateFormat = "ABSOLUTE"
Field Value
DateAndTimeDateFormat
String constant used to specify DateTimeDateFormat in layouts. Current value is DATE.
public const string DateAndTimeDateFormat = "DATE"
Field Value
Iso8601TimeDateFormat
String constant used to specify ISO8601DateFormat in layouts. Current value is ISO8601.
public const string Iso8601TimeDateFormat = "ISO8601"
Field Value
Methods
FormatDate(DateTime, TextWriter)
Renders the date into a string. Format is "HH:mm:ss,fff".
public virtual void FormatDate(DateTime dateToFormat, TextWriter writer)
Parameters
dateToFormatDateTimeThe date to render into a string.
writerTextWriterThe writer to write to.
Remarks
Uses the FormatDateWithoutMillis(DateTime, StringBuilder) method to generate the time string up to the seconds and then appends the current milliseconds. The results from FormatDateWithoutMillis(DateTime, StringBuilder) are cached and FormatDateWithoutMillis(DateTime, StringBuilder) is called at most once per second.
Sub classes should override FormatDateWithoutMillis(DateTime, StringBuilder) rather than FormatDate(DateTime, TextWriter).
FormatDateWithoutMillis(DateTime, StringBuilder)
Renders the date into a string. Format is "HH:mm:ss".
protected virtual void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer)
Parameters
dateToFormatDateTimeThe date to render into a string.
bufferStringBuilderThe string builder to write to.
Remarks
Subclasses should override this method to render the date into a string using a precision up to the second. This method will be called at most once per second and the result will be reused if it is needed again during the same second.