Class SerilogHelper
Inherited Members
Namespace: Code.Library.AspNetCore .Helpers
Assembly: Code.Library.AspNetCore.dll
Syntax
public static class SerilogHelper
Methods
| Improve this Doc View SourceEnrichFromRequest(IDiagnosticContext, HttpContext)
Declaration
public static void EnrichFromRequest(IDiagnosticContext diagnosticContext, HttpContext httpContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IDiagnostic |
diagnosticContext | |
| Http |
httpContext |
GetLevel(LogEventLevel, params string[])
Declaration
public static Func<HttpContext, double, Exception, LogEventLevel> GetLevel(LogEventLevel traceLevel, params string[] traceEndpointNames)
Parameters
| Type | Name | Description |
|---|---|---|
| Log |
traceLevel | |
| string[] | traceEndpointNames |
Returns
| Type | Description |
|---|---|
| Func<Http |
WithSimpleConfiguration(LoggerConfiguration, IConfiguration, IServiceProvider)
Provides standardized, centralized Serilog wire-up for a suite of applications.
Declaration
public static void WithSimpleConfiguration(this LoggerConfiguration loggerConfig, IConfiguration configuration, IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Logger |
loggerConfig | Provide this value from the UseSerilog method param |
| IConfiguration | configuration | IConfiguration settings -- generally read this from appsettings.json |
| IService |
serviceProvider |
Remarks
Sample appsettings "Serilog": { "MinimumLevel": { "Default": "Debug", "Override": { "Microsoft": "Warning", "System": "Warning", "IdentityServer4": "Information", "Orleans": "Warning" } }, "SeqServerUrl": null }