You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by Patrick Wagstrom <pw...@andrew.cmu.edu> on 2004/08/28 17:58:25 UTC

ColoredConsoleAppender for non Windows Platforms

Hi,

I'm new to the list and at the moment the archives seem to be a bit
broken, so my apologies if this is the wrong protocol to submit an
addition.

I've been using Log4Net under Mono on Linux and MacOSX for some of my
research and quickly became jealous that there was no way to get the
ColoredConsoleAppender under these platforms because of the use of Win32
APIs.  However, it's not difficult to do color on these platforms, just
send out ANSI escape sequences.

With that in mind, I present AnsiColoredConsoleAppender.  Just drop it
in with the other Appenders and recompile log4net and you can use it. 
Syntax works about the same as ColoredConsoleAppender with the exception
that foreColor and backColor can only be a color (none of the
HighIntensity stuff).  There also is a new tag, "attrs", that can be one
of Bright, Dim, Underscore, Blink, Reverse, Hidden, or Strikethrough.

Needless to say, it's based heavily on the ColoredConsoleAppender and
ConsoleAppender.  So props to Rick Hobbs and Nicko Cadell.

I've attached the code to this message, but if the list strips it out,
you can also find it at:
 
http://patrick.wagstrom.net/projects/personal/log4net/AnsiColoredConsoleAppender.cs

Feedback would be appreciated.

Thanks,

Patrick Wagstrom