Mezmo.Logging 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mezmo.Logging --version 1.0.0
NuGet\Install-Package Mezmo.Logging -Version 1.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="Mezmo.Logging" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mezmo.Logging --version 1.0.0
#r "nuget: Mezmo.Logging, 1.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.
// Install Mezmo.Logging as a Cake Addin
#addin nuget:?package=Mezmo.Logging&version=1.0.0

// Install Mezmo.Logging as a Cake Tool
#tool nuget:?package=Mezmo.Logging&version=1.0.0

GitHub license GitHub issues GitHub stars GitHub forks NuGet 1 NuGet 2

mezmo-logging

A library for ingesting logs into Mezmo (formerly LogDNA) on .NET 6.0 and greater. The library provides high performance logging, and focuses on reducing overheads such as allocations.

Both a lower level API Mezmo.Logging.IngestClient and a higher level Microsoft.Extensions.Logging provider are available. The lower level API will batch logs, the interval of batching can be configured on IIngestClient.SendInterval. Any exceptions which occur while sending logs will be printed in the debug output.

You should ensure that you call IIngestClient.DisposeAsync to flush any remaining logs before exiting your application. This will be done automatically by the application when using Microsoft.Extensions.Hosting and configuring the log provider properly.

Getting Started

NuGet Status

You can install the package using either the CLI:

dotnet add package Mezmo.Logging
or
dotnet add package Mezmo.Extensions.Logging

or from the NuGet package manager:

Install-Package Mezmo.Logging
or
Install-Package Mezmo.Extensions.Logging

Example

You can find an example setup usable with any Microsoft.Hosting.Extensions based application, including ASP.NET Core. This will not automatically record request based information, see the Metadata section for how to send log metadata.

You can configure the example with a Settings.json file, or by using the following environment variables.

Name Example Description
MEZMO__APIKEY xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Account ingestion key, required
MEZMO__TAGS mytag1, mytag2 Tags to apply to all logs, optional
MEZMO__APPNAME myapp Application name to apply to all logs, optional
MEZMO__URI https://logs.logdna.com Custom ingestion endpoint, optional

Metadata

The library supports recording metadata for the Microsoft.Extensions.Logging based logger. This is done using the scope system, see the Example.Hosting project for a hands on example. The scope state data will be serialized using System.Text.Json.JsonSerializer, you can pass a string directly to ILogger.BeginScope if you want to fully control the metadata formatting sent to Mezmo.

class MyData {
    public string IpAddress { get; set; }
    public string UserAgent { get; set; }
}

using (logger.BeginScope(myData)) {
    logger.LogInformation("Processing user request");
}

Contributing

Any pull requests or bug reports are welcome, please try and keep to the existing style conventions and comment any additions.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Mezmo.Logging:

Package Downloads
Mezmo.Extensions.Logging

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 1,347 9/27/2022
1.0.0 711 9/27/2022