Mash.Logging 1.0.1-preview

This is a prerelease version of Mash.Logging.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Mash.Logging --version 1.0.1-preview                
NuGet\Install-Package Mash.Logging -Version 1.0.1-preview                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mash.Logging" Version="1.0.1-preview" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mash.Logging --version 1.0.1-preview                
#r "nuget: Mash.Logging, 1.0.1-preview"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mash.Logging as a Cake Addin
#addin nuget:?package=Mash.Logging&version=1.0.1-preview&prerelease

// Install Mash.Logging as a Cake Tool
#tool nuget:?package=Mash.Logging&version=1.0.1-preview&prerelease                

Mash.Logging

Most of my code starts running locally in a console window, so I want logs printed to the screen. Soon that code begins running headless, and I rely on logs to know what happened after the fact. I don't want to change my logging up, I just want it to go to a different location. Sometimes, I want it to go to multiple locations.

This utility allows you to configure logging providers, and build loggers from that to hand off to business logic. It also lets you specify a common property bag of data to be automatically included with each log statement. Additionally, each logger instance can build its own context.

Initialization

To initialize logging:

var loggingBuilder = new LoggingBuilder();

// Add any app-level contextual properties
loggingBuilder.AppContext.Add("RunId", Guid.NewGuid().ToString());

// Add desired providers
loggingBuilder.LogProviders.Add(new ConsoleLogProvider());

var logger = loggingBuilder.BuildLogger(
    new Dictionary<string, string>
    {
        { "Operation", "ProcessOrders" },
    });

// Now pass off your logger to code to do work
ProcessOrders(logger);

Logging

Logging is simple. Code can log traces, metrics, or events. See this sample for examples.

If an operation branches off into more than one code path, you can clone the current logger which copies the current logger context into the new logger. Modifications to that logger's context will not affect the current one.

Logging providers

This utility includes a console logger, and you can build your own adapters to other destinations.

Product 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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 1.3

  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Mash.Logging:

Package Downloads
Mash.Logging.ApplicationInsights

Provides a logging abstraction for Azure Application Insights.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2-preview 5,755 9/12/2020
1.0.1-preview 309 8/18/2020
1.0.0-preview 300 8/17/2020

Initial release.