Skip to content

marios-siati/serilog-extensions

Repository files navigation

🪵 Serilog & SEQ Wrapper

This package offers an easy setup of serilog, with just a single line of code.

It is also useful in existing projects, where it would be an overhead to refactor each and every file to use serilog instead of MEL logger

  • Sets up structured logging by replacing normal Microsoft Extensions Logging (MEL) with Serilog.
  • Enriches the log context with the Application Name. Useful when working locally with multiple services.
  • Writes logs to Applications Insights
  • Writes logs to local SEQ instance for debugging.

The inspiration behind this package was the lack of structured logging support in Azure Functions V4 from MEL (especially logging custom properties in the log context) more here

https://www.nuget.org/packages/MariosSiati.StructuredLogging.Core/

Usage

Use the following extension method on IServiceCollection on app Startup:

UseSerilog(applicationName)

AppSettings

"seq": {
    "ServerUrl": "http://localhost:5341",
    "ApiKey": "1234567890",
    "MinimumLevel": "Trace",
    "LevelOverride": {
      "Microsoft": "Debug"
    }
  }

Samples

WebApp Logging: image

Function App Logging: image

Compatibility

.Net Core 6.0 .Net Functions Worker v4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages