DontPanicLabs.Ifx.Telemetry.Logger.Serilog 2.0.0

Prefix Reserved
dotnet add package DontPanicLabs.Ifx.Telemetry.Logger.Serilog --version 2.0.0
                    
NuGet\Install-Package DontPanicLabs.Ifx.Telemetry.Logger.Serilog -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DontPanicLabs.Ifx.Telemetry.Logger.Serilog" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DontPanicLabs.Ifx.Telemetry.Logger.Serilog" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DontPanicLabs.Ifx.Telemetry.Logger.Serilog" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DontPanicLabs.Ifx.Telemetry.Logger.Serilog --version 2.0.0
                    
#r "nuget: DontPanicLabs.Ifx.Telemetry.Logger.Serilog, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DontPanicLabs.Ifx.Telemetry.Logger.Serilog@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DontPanicLabs.Ifx.Telemetry.Logger.Serilog&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DontPanicLabs.Ifx.Telemetry.Logger.Serilog&version=2.0.0
                    
Install as a Cake Tool

DontPanicLabs.Ifx.Telemetry.Logger.Serilog

A Serilog-based implementation of DontPanicLabs.Ifx.Telemetry.Logger.Contracts.ILogger with support for multiple logging destinations.

Features

  • Multiple Sinks: Configure one or more logging destinations (SQL Server, File, Console, and 100+ community sinks)
  • Minimal Dependencies: Core package includes only Serilog runtime; consumers add references to desired sinks

Installation

Install the core logging package:

dotnet add package DontPanicLabs.Ifx.Telemetry.Logger.Serilog

IMPORTANT: You must also install the Serilog sink packages you want to use. The core package does not include any sinks.

For example, to use SQL Server, File, and Console sinks:

dotnet add package Serilog.Sinks.MSSqlServer
dotnet add package Serilog.Sinks.File
dotnet add package Serilog.Sinks.Console

Configuration

This logger can either be configured programmatically or via application configuration (appsettings.json, environment variables, etc).

Configuration Format

This logger uses Serilog's native configuration format. Configure your logger using one of the following options:

App Settings / Environment Variables-based configuration:

Configure one or more logging sinks by adding standard serilog settings for the sink in your app settings under ifx:telemetry:logging:serilog.

Specify Serilog configuration programmatically:

The Logger also exposes a constructor that accepts a string representing the Serilog configuration in JSON format.

var logger = new Logger(serilogJsonConfig);

where serilogJsonConfig is a string containing the Serilog configuration whose structure is the same as what would be in ifx:telemetry:logging:serilog:

{
    "MinimumLevel": "Debug",
    "WriteTo": [ "Console" ],
    ...
}

Single Sink Example (SQL Server)

This sample configuration configures logging to SQL server. The columnOptionsSection shown here configures writing the metrics and properties IDictionary<string, object> parameters passed to the logging methods to be written as JSON to the LogEvent column in the SQL table. If columnOptionsSection is not specified, the default Serilog behavior writes this data as XML in the Properties column.

{
  "ifx": {
    "telemetry": {
      "logging": {
        "serilog": {
          "Using": ["Serilog.Sinks.MSSqlServer"],
          "MinimumLevel": "Verbose",
          "WriteTo": [
            {
              "Name": "MSSqlServer",
              "Args": {
                "connectionString": "{YOUR SQL CONNECTION STRING HERE}",
                "sinkOptionsSection": {
                  "tableName": "Logs",
                  "schemaName": "dbo",
                  "autoCreateSqlTable": true,
                  "batchPostingLimit": 50,
                  "batchPeriod": "0.00:00:05"
                },
                "columnOptionsSection": {
                  "addStandardColumns": ["LogEvent"],
                  "removeStandardColumns": ["Properties"],
                  "logEvent": {
                    "excludeStandardColumns": true
                  }
                }
              }
            }
          ]
        }
      }
    }
  }
}

Multiple Sinks Example

Log to a rolling file log and the console, both using JSON formatting to display structured log data.

{
  "ifx": {
    "telemetry": {
      "logging": {
        "serilog": {
          "Using": ["Serilog.Sinks.File", "Serilog.Sinks.Console"],
          "MinimumLevel": "Verbose",
          "WriteTo": [
            {
              "Name": "File",
              "Args": {
                "formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog",
                "path": "logs/app-.log",
                "rollingInterval": "Day",
                "retainedFileCountLimit": 7
              }
            },
            {
              "Name": "Console",
              "Args": {
                "formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
              }
            }
          ]
        }
      }
    }
  }
}

Usage

Basic Setup


// Create the logger (automatically loads configuration from appsettings.json); namespaces shown in-line for clarity.
// Consuming code should instantiate the logger but use the `ILogger` interface to interact.
DontPanicLabs.Ifx.Telemetry.Logger.Contracts.ILogger logger = new DontPanicLabs.Ifx.Telemetry.Logger.Serilog.Logger();

// Use the logger
logger.Log("Application started", SeverityLevel.Information, null);
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 1,138 12/15/2025
0.2.0 421 10/17/2025
0.1.0 236 10/9/2025