Darzid.Logging.Console
1.0.3
See the version list below for details.
dotnet add package Darzid.Logging.Console --version 1.0.3
NuGet\Install-Package Darzid.Logging.Console -Version 1.0.3
<PackageReference Include="Darzid.Logging.Console" Version="1.0.3" />
paket add Darzid.Logging.Console --version 1.0.3
#r "nuget: Darzid.Logging.Console, 1.0.3"
// Install Darzid.Logging.Console as a Cake Addin #addin nuget:?package=Darzid.Logging.Console&version=1.0.3 // Install Darzid.Logging.Console as a Cake Tool #tool nuget:?package=Darzid.Logging.Console&version=1.0.3
Overview
This console logger is a MS.Extensions.Logging compatible logger, which supports:
- Smart line rewrites, to keep console logs compact.
- A "breadcrumb" of scopes, like a folder path, in a configurable color
- Argument coloring.
Line rewrites
When logging a "normal" message (not a Warning, Error or Critical) from within the same scope, it updates the existing console line, instead of writing a new line. This means that it acts more like a "progress overview", instead of 1000's of lines zooming by on your console screen.
For example: Without rewriting, a console log line could look like this:
- MyProcessorApp: Started
- MyProcessorApp: Creating Document Processor
- MyProcessorApp: Starting Document Processor
- MyProcessorApp\DocumentProcessor: Loading documents
- MyProcessorApp\DocumentProcessor: Processing documents
- MyProcessorApp\DocumentProcessor\Document1: Started processing document
- MyProcessorApp\DocumentProcessor\Document1: Calling webservice
- MyProcessorApp\DocumentProcessor\Document1: Calling another webservice
- MyProcessorApp\DocumentProcessor\Document1: Saving document
- MyProcessorApp\DocumentProcessor\Document2: Started processing document
- MyProcessorApp\DocumentProcessor\Document2: Calling webservice
- MyProcessorApp\DocumentProcessor\Document2: Calling another webservice
- MyProcessorApp\DocumentProcessor\Document2: Warning: Didn't get expected response
- MyProcessorApp\DocumentProcessor\Document2: Saving document
- MyProcessorApp\DocumentProcessor: Processing done
- MyProcessorApp: Finished
However, with rewriting enabled, it will look
- MyProcessorApp: Started / Creating Document Processor / Starting Document Processor (so, this single line will be updated 3 times)
- MyProcessorApp\DocumentProcessor: Loading documents / Processing documents (2 updates)
- MyProcessorApp\DocumentProcessor\Document1: Started processing document / Calling webservice / Calling another webservice / Saving document
- MyProcessorApp\DocumentProcessor\Document2: Started processing document / Calling webservice / Calling another webservice
- MyProcessorApp\DocumentProcessor\Document2: Warning: Didn't get expected response
- MyProcessorApp\DocumentProcessor\Document2: Saving document
- MyProcessorApp\DocumentProcessor: Processing done
- MyProcessorApp: Finished
Although this is a simplified example, it reduces the number of lines with 50% (from 16 to 8).
In certain situations, a message is always written on a new line.
- When the LogLevel is Warning, Error or Critical, that particular line is written as a new line, so the last log message BEFORE the warning, error or critical log message is still displayed on screen. And the subsequent log message that is written AFTER the warning, error or critical log message is also written as a new line, so that the warning, error or critical log message remains visible.
- When the scope of the previous log message and the current log message is different, the message is written as a new line. So, the last message of the previous scope will remain visible.
- When some other logger or code wrote to the Console between the previous log message and the current log message. The Logger then continues writing below the messages that were written to the console outside of the Logger. So, when some code directly uses Console.WriteLine to write 5 lines, the logger will continue below the 5th line.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Darzid.Logging.Interfaces (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.