log4net.AppenderAppenderSkeleton
log4net.AppenderAnsiColorTerminalAppender
Namespace: log4net.Appender
Assembly: log4net (in log4net.dll) Version: 2.0.6.0-.NET 4.0
The AnsiColorTerminalAppender type exposes the following members.
Name | Description | |
---|---|---|
AnsiColorTerminalAppender |
Initializes a new instance of the AnsiColorTerminalAppender class.
|
Name | Description | |
---|---|---|
ErrorHandler |
Gets or sets the IErrorHandler for this appender.
(Inherited from AppenderSkeleton.) | |
FilterHead |
The filter chain.
(Inherited from AppenderSkeleton.) | |
Layout |
Gets or sets the ILayout for this appender.
(Inherited from AppenderSkeleton.) | |
Name |
Gets or sets the name of this appender.
(Inherited from AppenderSkeleton.) | |
RequiresLayout |
This appender requires a log4net.Layout to be set.
(Overrides AppenderSkeletonRequiresLayout.) | |
Target |
Target is the value of the console output stream.
| |
Threshold |
Gets or sets the threshold Level of this appender.
(Inherited from AppenderSkeleton.) |
Name | Description | |
---|---|---|
ActivateOptions |
Initialize the options for this appender
(Overrides AppenderSkeletonActivateOptions.) | |
AddFilter |
Adds a filter to the end of the filter chain.
(Inherited from AppenderSkeleton.) | |
AddMapping |
Add a mapping of level to color
| |
Append(LoggingEvent) |
This method is called by the DoAppend(LoggingEvent) method.
(Overrides AppenderSkeletonAppend(LoggingEvent).) | |
Append(LoggingEvent) |
Append a bulk array of logging events.
(Inherited from AppenderSkeleton.) | |
ClearFilters |
Clears the filter list for this appender.
(Inherited from AppenderSkeleton.) | |
Close |
Closes the appender and release resources.
(Inherited from AppenderSkeleton.) | |
DoAppend(LoggingEvent) |
Performs threshold checks and invokes filters before
delegating actual logging to the subclasses specific
[M:Append(LoggingEvent)] method.
(Inherited from AppenderSkeleton.) | |
DoAppend(LoggingEvent) |
Performs threshold checks and invokes filters before
delegating actual logging to the subclasses specific
[M:Append(LoggingEvent[])] method.
(Inherited from AppenderSkeleton.) | |
Equals | (Inherited from Object.) | |
FilterEvent |
Test if the logging event should we output by this appender
(Inherited from AppenderSkeleton.) | |
Finalize |
Finalizes this appender by calling the implementation's
Close method.
(Inherited from AppenderSkeleton.) | |
Flush |
Flushes any buffered log data.
(Inherited from AppenderSkeleton.) | |
GetHashCode |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
GetType |
Gets the Type of the current instance.
(Inherited from Object.) | |
IsAsSevereAsThreshold |
Checks if the message level is below this appender's threshold.
(Inherited from AppenderSkeleton.) | |
MemberwiseClone |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
OnClose |
Is called when the appender is closed. Derived classes should override
this method if resources need to be released.
(Inherited from AppenderSkeleton.) | |
PreAppendCheck |
Called before [M:Append(LoggingEvent)] as a precondition.
(Inherited from AppenderSkeleton.) | |
RenderLoggingEvent(LoggingEvent) |
Renders the LoggingEvent to a string.
(Inherited from AppenderSkeleton.) | |
RenderLoggingEvent(TextWriter, LoggingEvent) |
Renders the LoggingEvent to a string.
(Inherited from AppenderSkeleton.) | |
ToString | (Inherited from Object.) |
Name | Description | |
---|---|---|
ConsoleError |
The Target to use when writing to the Console
standard error output stream.
| |
ConsoleOut |
The Target to use when writing to the Console
standard output stream.
|
AnsiColorTerminalAppender appends log events to the standard output stream or the error output stream using a layout specified by the user. It also allows the color of a specific level of message to be set.
Note |
---|
This appender expects the terminal to understand the VT100 control set in order to interpret the color codes. If the terminal or console does not understand the control codes the behavior is not defined. |
By default, all output is written to the console's standard output stream. The Target property can be set to direct the output to the error stream.
NOTE: This appender writes each message to the System.Console.Out or System.Console.Error that is set at the time the event is appended. Therefore it is possible to programmatically redirect the output of this appender (for example NUnit does this to capture program output). While this is the desired behavior of this appender it may have security implications in your application.
When configuring the ANSI colored terminal appender, a mapping should be specified to map a logging level to a color. For example:
<mapping><level value="ERROR" /><foreColor value="White" /><backColor value="Red" /><attributes value="Bright,Underscore" /></mapping><mapping><level value="DEBUG" /><backColor value="Green" /></mapping>
The Level is the standard log4net logging level and ForeColor and BackColor can be any of the following values:
- Blue -
- Green -
- Red -
- White -
- Yellow -
- Purple -
- Cyan -
The attributes can be any combination of the following:
- Bright - foreground is brighter
- Dim - foreground is dimmer
- Underscore - message is underlined
- Blink - foreground is blinking (does not work on all terminals)
- Reverse - foreground and background are reversed
- Hidden - output is hidden
- Strikethrough - message has a line through it