Repository navigation
v2.6.0
New features
Improved support of ANSI color codes in log patterns
ConsoleAppenderbecomes a simple implementation ofStreamAppender:- Color output now uses ANSI codes on Windows
- Coloring becomes customizable through the given
FormatterorDefaultStyle(see below)
- Better SGR codes support in
PatternWriterandDefaultFormatter:- New placeholders:
%levelColor: configurable through theLogLevelColorsproperty%resetColor: an alias for\e[0m
- The strings in the pattern, the
LogLevelsandLogLevelColorsproperties all support custom SGR codes - The
%{column:n}placeholder now counts by grapheme clusters
- New placeholders:
- Added a few example styles in the
DefaultStyleclass which can be supplied to theConsoleAppenderconstructor- Current default style for
ConsoleAppender:DefaultStyle.Colored.BlueAndWhite(or its plain text version ifColorOutputis false) - Current default style for
DefaultFormatter:DefaultStyle.NoColor.Simple - See the
ZeroLog.Examplesproject orcattheexamples.txtfile from the artifacts in a console for a preview
- Current default style for
- New APIs:
DefaultFormatter.MessagePatternWriterto configure colors in the patternWithoutAnsiColorCodes()inPatternWriterandDefaultFormatterto return a version without color codesAppender.Initialize()which is called before an appender is first usedStreamAppender.Formatterchanges frominittoset- New constructors in
ConsoleAppenderandDefaultFormatter
Analyzers and code fixes
-
Added a code fix which lets you change from the simple syntax (
_log.Info(...)) toAppendsyntax (_log.Info().Append(...).Log()).
This is particularly useful if you want to add structured data to a log message:


-
Renamed "Use string interpolation" to "Use simple syntax" for consistency. This undoes the previous fix:


-
Added a
[PatternWriter.Pattern]attribute to analyze a literal pattern string on customstringarguments and properties