Serilog.Sinks.Map 2.0.0

Prefix Reserved
dotnet add package Serilog.Sinks.Map --version 2.0.0
                    
NuGet\Install-Package Serilog.Sinks.Map -Version 2.0.0
                    
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="Serilog.Sinks.Map" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Serilog.Sinks.Map" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Serilog.Sinks.Map" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Serilog.Sinks.Map --version 2.0.0
                    
#r "nuget: Serilog.Sinks.Map, 2.0.0"
                    
#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.
#addin nuget:?package=Serilog.Sinks.Map&version=2.0.0
                    
Install Serilog.Sinks.Map as a Cake Addin
#tool nuget:?package=Serilog.Sinks.Map&version=2.0.0
                    
Install Serilog.Sinks.Map as a Cake Tool

Serilog.Sinks.Map Build status NuGet Pre Release

A Serilog sink wrapper that dispatches events based on a property value.

Getting started

Install the package from NuGet:

dotnet add package Serilog.Sinks.Map

The WriteTo.Map() method accepts a property name to use as a sink selector, a default value to use when the property is not attached, and a function that configures the sinks based on each property value.

For example, when using Serilog.Sinks.File:

dotnet add package Serilog.Sinks.File

The value of a log event property like Name can be inserted into log filenames:

Log.Logger = new LoggerConfiguration()
    .WriteTo.Map("Name", "Other", (name, wt) => wt.File($"./logs/log-{name}.txt"))
    .CreateLogger();

Log.Information("Hello, {Name}!", "Alice");
// -> Event written to log-Alice.txt

Log.Information("Hello, {Name}!", "Bob");
// -> Event written to log-Bob.txt

Log.Information("Shutting down");
// -> Event written to log-Other.txt

Log.CloseAndFlush();

Limiting the number of open sinks

By default, the target sinks opened by this sink won't be closed/disposed until the mapped sink is. This is efficient for dispatching to a finite number of sinks, e.g. file-per-log-level and so-on, but isn't suitable when the set of possible key values is open-ended.

To limit the number of target sinks that will be kept open in the map, specify sinkMapCountLimit:

    .WriteTo.Map("Name",
                 "Other",
                 (name, wt) => wt.File($"./logs/log-{name}.txt"),
                 sinkMapCountLimit: 10)

To keep no sinks open, i.e. close them immediately after processing each event, a sinkMapCountLimit of zero may be specified.

Configuration with <appSettings> and appSettings.json

Serilog.Sinks.Map is built around a mapping function, and as such, isn't able to be configured using XML or JSON configuration.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 is compatible.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 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.

NuGet packages (31)

Showing the top 5 NuGet packages that depend on Serilog.Sinks.Map:

Package Downloads
Umbraco.Cms.Infrastructure

Contains the infrastructure assembly needed to run Umbraco CMS.

UmbracoCms.Core

Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms package to setup Umbraco in Visual Studio as an ASP.NET project.

HwApp.Serilog

HwApp Serilog common and defaults

Microsoft.ComponentDetection

Package Description

Sukt.SeriLog

Package Description

GitHub repositories (12)

Showing the top 12 popular GitHub repositories that depend on Serilog.Sinks.Map:

Repository Stars
umbraco/Umbraco-CMS
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
GitTools/GitVersion
From git log to SemVer in no time
microsoft/sbom-tool
The SBOM tool is a highly scalable and enterprise ready tool to create SPDX 2.2 compatible SBOMs for any variety of artifacts.
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK.
microsoft/component-detection
Scans your project to determine what components you use
sunnamed434/BitMono
Obfuscator for .NET and Mono, with a customizable engine for building your own obfuscators.
TanvirArjel/CleanArchitecture
This repository contains the implementation of domain-driven design and clear architecture in ASP.NET Core.
Mutagen-Modding/Synthesis
A patcher pipeline framework and GUI. Run collections of code-based mods to create content customized for your load order
StarEliteCore/Nebula.Admin
Destiny.Core.Flow是基于.Net Core,VUE前后分离,开发的一个开源Admin管理框架目前有以下模块:菜单管理、用户管理、角色管理、用户角色、角色权限等功能。
serilog-contrib/serilog-ui
Simple Serilog log viewer UI for several sinks.
Yomalex/MuEmu
C# MuOnline Server Implementation for support multiple client version now aims to Season 16 Kor
Version Downloads Last updated
2.0.0 754,635 7/11/2024
2.0.0-dev-00048 111 7/10/2024
1.0.2 10,032,639 12/1/2020
1.0.2-dev-00040 412 12/1/2020
1.0.2-dev-00031 1,166 4/17/2020
1.0.1 332,233 2/19/2020
1.0.1-dev-00028 520 2/13/2020
1.0.1-dev-00025 4,736 5/2/2019
1.0.0 1,160,370 4/21/2019
1.0.0-dev-00020 690 4/21/2019
1.0.0-dev-00017 25,666 9/23/2018
1.0.0-dev-00012 4,843 10/28/2017
1.0.0-dev-00008 976 10/26/2017
1.0.0-dev-00006 940 10/26/2017
1.0.0-dev-00004 973 10/24/2017
1.0.0-dev-00001 1,163 6/6/2017