Ads by Lake Quincy Media

Wiki Navigation

 
Gibraltar - Learn about the best analysis tool for NLog

ColoredConsole target

NLog documentation is a Wiki, which allows registered users to edit its content.
If you want to contribute, please create a user account and contact Jarek to get edit access.

Writes log messages to the console with customizable coloring. 

Supported in

Configuration Syntax

<targets>
  <target xsi:type="ColoredConsole"
          name="String"
          layout="Layout"
          header="Layout"
          footer="Layout"
          useDefaultRowHighlightingRules="Boolean"
          errorStream="Boolean">
    <highlight-row backgroundColor="Enum" condition="Condition" foregroundColor="Enum"/><!-- repeated -->
    <highlight-word backgroundColor="Enum" foregroundColor="Enum" ignoreCase="Boolean"
                    regex="String" text="String" wholeWords="Boolean"/><!-- repeated -->
  </target>
</targets>
Read more about using the Configuration File.

Parameters

  • General Options
  • name - Name of the target.
  • Layout Options
  • layout - Text to be rendered.Layout Required. Default: ${longdate}|${level:uppercase=true}|${logger}|${message}
  • header - Header.Layout
  • footer - Footer.Layout
  • Highlighting Rules
  • useDefaultRowHighlightingRules - Indicates whether to use default row highlighting rules.Boolean Default: True
    The default rules are:
    ConditionForeground ColorBackground Color
    level == LogLevel.FatalRedNoChange
    level == LogLevel.ErrorYellowNoChange
    level == LogLevel.WarnMagentaNoChange
    level == LogLevel.InfoWhiteNoChange
    level == LogLevel.DebugGrayNoChange
    level == LogLevel.TraceDarkGrayNoChange
  • rowHighlightingRules - The row highlighting rules.Collection
    Each collection item is represented by <highlight-row /> element with the following attributes:
    • backgroundColor - Background color. Default: NoChange
      Possible values:
      • Black - Black Color (#000000).
      • Blue - Blue Color (#0000FF).
      • Cyan - Cyan Color (#00FFFF).
      • DarkBlue - Dark blue Color (#000080).
      • DarkCyan - Dark Cyan Color (#008080).
      • DarkGray - Dark Gray Color (#808080).
      • DarkGreen - Dark green Color (#008000).
      • DarkMagenta - Dark Magenta Color (#800080).
      • DarkRed - Dark Red Color (#800000).
      • DarkYellow - Dark Yellow Color (#808000).
      • Gray - Gray Color (#C0C0C0).
      • Green - Green Color (#00FF00).
      • Magenta - Magenta Color (#FF00FF).
      • NoChange - Don't change the color.
      • Red - Red Color (#FF0000).
      • White - White Color (#FFFFFF).
      • Yellow - Yellow Color (#FFFF00).
    • condition - Condition that must be met in order to set the specified foreground and background color.Condition Required.
    • foregroundColor - Foreground color. Default: NoChange
      Possible values:
      • Black - Black Color (#000000).
      • Blue - Blue Color (#0000FF).
      • Cyan - Cyan Color (#00FFFF).
      • DarkBlue - Dark blue Color (#000080).
      • DarkCyan - Dark Cyan Color (#008080).
      • DarkGray - Dark Gray Color (#808080).
      • DarkGreen - Dark green Color (#008000).
      • DarkMagenta - Dark Magenta Color (#800080).
      • DarkRed - Dark Red Color (#800000).
      • DarkYellow - Dark Yellow Color (#808000).
      • Gray - Gray Color (#C0C0C0).
      • Green - Green Color (#00FF00).
      • Magenta - Magenta Color (#FF00FF).
      • NoChange - Don't change the color.
      • Red - Red Color (#FF0000).
      • White - White Color (#FFFFFF).
      • Yellow - Yellow Color (#FFFF00).
  • wordHighlightingRules - The word highlighting rules.Collection
    Each collection item is represented by <highlight-word /> element with the following attributes:
    • backgroundColor - Background color. Default: NoChange
      Possible values:
      • Black - Black Color (#000000).
      • Blue - Blue Color (#0000FF).
      • Cyan - Cyan Color (#00FFFF).
      • DarkBlue - Dark blue Color (#000080).
      • DarkCyan - Dark Cyan Color (#008080).
      • DarkGray - Dark Gray Color (#808080).
      • DarkGreen - Dark green Color (#008000).
      • DarkMagenta - Dark Magenta Color (#800080).
      • DarkRed - Dark Red Color (#800000).
      • DarkYellow - Dark Yellow Color (#808000).
      • Gray - Gray Color (#C0C0C0).
      • Green - Green Color (#00FF00).
      • Magenta - Magenta Color (#FF00FF).
      • NoChange - Don't change the color.
      • Red - Red Color (#FF0000).
      • White - White Color (#FFFFFF).
      • Yellow - Yellow Color (#FFFF00).
    • foregroundColor - Foreground color. Default: NoChange
      Possible values:
      • Black - Black Color (#000000).
      • Blue - Blue Color (#0000FF).
      • Cyan - Cyan Color (#00FFFF).
      • DarkBlue - Dark blue Color (#000080).
      • DarkCyan - Dark Cyan Color (#008080).
      • DarkGray - Dark Gray Color (#808080).
      • DarkGreen - Dark green Color (#008000).
      • DarkMagenta - Dark Magenta Color (#800080).
      • DarkRed - Dark Red Color (#800000).
      • DarkYellow - Dark Yellow Color (#808000).
      • Gray - Gray Color (#C0C0C0).
      • Green - Green Color (#00FF00).
      • Magenta - Magenta Color (#FF00FF).
      • NoChange - Don't change the color.
      • Red - Red Color (#FF0000).
      • White - White Color (#FFFFFF).
      • Yellow - Yellow Color (#FFFF00).
    • ignoreCase - Indicates whether to ignore case when comparing texts.Boolean Default: False
    • regex - Regular expression to be matched. You must specify either text or regex.
    • text - Text to be matched. You must specify either text or regex.
    • wholeWords - Indicates whether to match whole words only.Boolean Default: False
  • Output Options
  • errorStream - Indicates whether the error stream (stderr) should be used instead of the output stream (stdout).Boolean Default: False
Ads by Lake Quincy Media