Search Results for

      Show / Hide Table of Contents

      Intent.AspNetCore.Logging.Serilog

      What is Serilog?

      Serilog is a structured logging library for .NET that enables rich, queryable log events. See the official docs: https://serilog.net and https://github.com/serilog/serilog.

      What This Module Generates

      • Serilog startup configuration (via factory extension) wiring sinks and enrichers.
      • Optional bounded logging destructuring policy class (BoundedLoggingDestructuringPolicy).
      • Configuration settings surface ("Serilog Settings" group) with selectable sinks.

      Module Settings

      Sinks (multi-select)

      Configurable sinks generated into the Serilog bootstrap:

      • console
      • file
      • graylog
      • application-insights

      Adjust in Intent Architect under the module's settings. Only selected sinks are added to the logging pipeline.

      Examples (Generated Pattern)

      // Program.cs excerpt (conceptual – actual code generated by Intent):
      Log.Logger = new LoggerConfiguration()
          .ReadFrom.Configuration(configuration)
          .Enrich.FromLogContext()
          .WriteTo.Console()           // if console selected
          .WriteTo.File("logs/log.txt", rollingInterval: RollingInterval.Day) // if file selected
          // Additional sinks conditionally added
          .CreateLogger();
      
      // BoundedLoggingDestructuringPolicy.cs (example intent-generated skeleton)
      public class BoundedLoggingDestructuringPolicy : IDestructuringPolicy { /* ... */ }
      

      When to Use

      Use this module when you need structured logging beyond simple console or Debug output and want Intent to manage initial Serilog wiring. For distributed tracing and metrics, pair with OpenTelemetry; Serilog focuses on logs.

      Serilog vs OpenTelemetry

      • Serilog: Application log events (structured text).
      • OpenTelemetry: Traces, metrics, sometimes logs but different lifecycle. Use both for a complete observability stack.

      Integration with Other Modules

      • Depends on Intent.AspNetCore for host startup integration.
      • Works alongside Intent.OpenTelemetry and health checks.
      • Can complement error monitoring modules (e.g., Bugsnag) by providing contextual log data.

      Intent-Specific Notes

      • Sinks list drives conditional code generation; no manual editing required for initial setup.
      • Destructuring policy template allows safe logging of complex object graphs.

      External Resources

      • Serilog Site: https://serilog.net
      • GitHub Repo: https://github.com/serilog/serilog
      • Sinks Catalog: https://github.com/serilog/serilog/wiki/Provided-Sinks

      Related Modules

      • Intent.OpenTelemetry
      • Intent.Bugsnag
      • Intent.AspNetCore.HealthChecks
      • Edit this page
      ☀
      ☾
      In this article
      Back to top Copyright © 2017-, Intent Architect Holdings Ltd