• Articles
  • API Documentation
  • GitHub
  • Abhith
  • API Documentation
  • Code.Library.AspNetCore.Helpers
  • SerilogHelper

    Show / Hide Table of Contents
    • Code.Library
      • Breadcrumb
      • BreadcrumbNode
      • IAuditedObject
      • IAuditedObject<TUser>
      • ICreationAuditedObject
      • ICreationAuditedObject<TCreator>
      • IDeletionAuditedObject
      • IDeletionAuditedObject<TUser>
      • IHasCreationTime
      • IHasDeletionTime
      • IHasModificationTime
      • IMayHaveCreator
      • IMayHaveCreator<TCreator>
      • IModificationAuditedObject
      • IModificationAuditedObject<TUser>
      • IResult
      • ISoftDelete
      • Result
      • Result<T>
      • Result<T, E>
      • ResultFailureException
      • ResultFailureException<E>
      • ResultSuccessException
    • Code.Library.Application.Behaviors
      • LoggingBehavior<TRequest, TResponse>
      • RequestPerformanceBehavior<TRequest, TResponse>
      • UnhandledExceptionBehavior<TRequest, TResponse>
    • Code.Library.AspNetCore
      • PerfTracker
      • ServiceCollectionExtensions
    • Code.Library.AspNetCore.Attributes
      • LogUsageAttribute
    • Code.Library.AspNetCore.Extensions
      • HealthCheckEndpointRouteBuilderExtensions
      • HttpRequestExtensions
      • ILoggerExtensions
    • Code.Library.AspNetCore.Filters
      • TrackPerformanceFilter
    • Code.Library.AspNetCore.Helpers
      • SerilogHelper
    • Code.Library.AspNetCore.Middleware
      • ApiExceptionMiddleware
      • ApiExceptionMiddlewareExtensions
      • ApiExceptionOptions
      • RequestLoggingMiddlewareExtensions
    • Code.Library.AspNetCore.Middleware.RequestResponseLogging
      • ExcludeInRequestResponseLoggingOptions
      • IncludeInRequestResponseLoggingOptions
      • RequestResponseLoggingMiddleware
      • RequestResponseLoggingMiddlewareExtensions
      • RequestResponseLoggingOptions
    • Code.Library.Domain.Models
      • Enumeration
    • Code.Library.Dtos
      • AuditedEntityDto
      • AuditedEntityDto<TPrimaryKey>
      • CreationAuditedEntityDto
      • CreationAuditedEntityDto<TPrimaryKey>
      • EntityDto
      • EntityDto<TKey>
      • EntityRequestDto<TKey>
      • FullAuditedEntityDto
      • FullAuditedEntityDto<TPrimaryKey>
      • IEntityDto
      • IEntityDto<TKey>
      • IFullAuditedObject
      • IFullAuditedObject<TUser>
      • IHasTotalCount
      • ILimitedResultRequest
      • IListResult<T>
      • IPagedAndSortedResultRequest
      • IPagedResult<T>
      • IPagedResultRequest
      • ISortedResultRequest
      • LimitedResultRequestDto
      • ListResultDto<T>
      • PagedAndSortedResultRequestDto
      • PagedResultDto<T>
      • PagedResultRequestDto
    • Code.Library.Exceptions
      • DomainException
    • Code.Library.Extensions
      • DateTimeExtensions
      • FileSystemExtensions
      • GenericTypeExtensions
      • IEnumerableExtensions
      • NumberExtensions
      • ResultExtensions
      • StringExtensions
    • Code.Library.Helpers
      • DateTimeHelper
      • FileHelper
      • SerializationHelper
      • ThirdPartyHelper

    Class SerilogHelper

    Inheritance
    object
    SerilogHelper
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Code.Library.AspNetCore.Helpers
    Assembly: Code.Library.AspNetCore.dll
    Syntax
    public static class SerilogHelper

    Methods

    | Improve this Doc View Source

    EnrichFromRequest(IDiagnosticContext, HttpContext)

    Declaration
    public static void EnrichFromRequest(IDiagnosticContext diagnosticContext, HttpContext httpContext)
    Parameters
    Type Name Description
    IDiagnosticContext diagnosticContext
    HttpContext httpContext
    | Improve this Doc View Source

    GetLevel(LogEventLevel, params string[])

    Declaration
    public static Func<HttpContext, double, Exception, LogEventLevel> GetLevel(LogEventLevel traceLevel, params string[] traceEndpointNames)
    Parameters
    Type Name Description
    LogEventLevel traceLevel
    string[] traceEndpointNames
    Returns
    Type Description
    Func<HttpContext, double, Exception, LogEventLevel>
    | Improve this Doc View Source

    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
    LoggerConfiguration loggerConfig

    Provide this value from the UseSerilog method param

    IConfiguration configuration

    IConfiguration settings -- generally read this from appsettings.json

    IServiceProvider serviceProvider
    Remarks

    Sample appsettings "Serilog": { "MinimumLevel": { "Default": "Debug", "Override": { "Microsoft": "Warning", "System": "Warning", "IdentityServer4": "Information", "Orleans": "Warning" } }, "SeqServerUrl": null }

    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • EnrichFromRequest(IDiagnosticContext, HttpContext)
      • GetLevel(LogEventLevel, params string[])
      • WithSimpleConfiguration(LoggerConfiguration, IConfiguration, IServiceProvider)
    Back to top Generated by Abhith Rajan using DocFX