Change Color of Level in ColoredConsole

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Change Color of Level in ColoredConsole

kmrezwan
2 questions -
1. Is there any way I can change the color of different levels (Warn, Error, etc.) when target type is : ColoredConsole ?
2. Is there any way to add new level in addition to those ( such as Pass/Success etc, with green color) ??

Sorry if the answered were already mentioned somewhere else ? I just skimmed through the doc, but couldn't find the answers ?
Reply | Threaded
Open this post in threaded view
|

Re: Change Color of Level in ColoredConsole

Jarek Kowalski
Administrator
Basically you need to provide your own set of coloring rules as demo-ed here:

http://www.nlog-project.org/target.ColoredConsole.html

Look for <highlight-row in the examples section. To disable built-in coloring rules set: useDefaultRowHighlightingRules="false". Intellisense in Visual Studio will help you with editing the rules.

See the Conditions page (http://www.nlog-project.org/conditions.html) for more information about possible highlight conditions.

Jarek

NLog Blog
Reply | Threaded
Open this post in threaded view
|

Re: Change Color of Level in ColoredConsole

kmrezwan
Thank you so much for prompt reply, and for making such a flexible, wonderful framework