Deprecation notice: this package is no longer maintained. The world has moved on to ASP.NET Core. Take a look at Serilog.AspNetCore instead!
ASP.NET MVC support for SerilogWeb.Classic.
Package - SerilogWeb.Classic.Mvc | Platforms - .NET 4.5
This package is designed for full framework ASP.NET applications. For ASP.NET Core, have a look at Serilog.AspNetCore
This package is used in conjunction with SerilogWeb.Classic and adds ASP.NET MVC specific enrichers.
The following enrichers are available as extension methods from the LoggerConfiguration.Enrich
API:
MvcAction
containing the name of the Action being executed in the MVC ControllerMvcController
containing the name of the Controller in which a MVC Action has executedMvcRouteData
containing the dictionary of the RouteDataMvcRouteTemplate
containing the route template selected by Mvc routingUsage :
var log = new LoggerConfiguration() .WriteTo.Console() .Enrich.WithMvcRouteTemplate() .Enrich.WithMvcActionName() .CreateLogger();
To override the property name of the added property:
var log = new LoggerConfiguration() .WriteTo.Console() .Enrich.WithMvcRouteTemplate("RouteTemplate") .CreateLogger();
Enrichers can also be defined in a configuration file by using Serilog.Settings.AppSettings as follows:
<appSettings> <add key="serilog:using:SerilogWeb.Classic.Mvc" value="SerilogWeb.Classic.Mvc"/> <add key="serilog:enrich:WithMvcActionName"/> <add key="serilog:enrich:WithMvcControllerName"/> <add key="serilog:enrich:WithMvcRouteData"/> <add key="serilog:enrich:WithMvcRouteTemplate"/> </appSettings>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4