NorthWestNodes.Common
0.4.2
The Datadog logger within Northwest Nodes LLC-FZ has been discontinued and migrated to Web349.Logging
See the version list below for details.
dotnet add package NorthWestNodes.Common --version 0.4.2
NuGet\Install-Package NorthWestNodes.Common -Version 0.4.2
<PackageReference Include="NorthWestNodes.Common" Version="0.4.2" />
paket add NorthWestNodes.Common --version 0.4.2
#r "nuget: NorthWestNodes.Common, 0.4.2"
// Install NorthWestNodes.Common as a Cake Addin
#addin nuget:?package=NorthWestNodes.Common&version=0.4.2
// Install NorthWestNodes.Common as a Cake Tool
#tool nuget:?package=NorthWestNodes.Common&version=0.4.2
NorthWest Nodes common library
The NorthWest Nodes Common Library is a class library written in C# using the .NET Core 7.0 framework. It contains several common functions used throughout the closed- and open-source projects at NorthWest Nodes (https://northwestnodes.com).
One of its main features is a highly flexible Datadog logger.
Datadog logger
Configuration
Namespaces:
NorthWestNodes.Common.Logging
NorthWestNodes.Common.Logging.Datadog
Environment variables:
DD_API_KEY
: the API key for your Datadog appDD_HOST
: theHost
column in DatadogDD_SERVICE
: theService
column in DatadogDD_SOURCE
: theSource
column in Datadog
Usage examples
Send a basic Datadog log event:
Log log = DDLog.Create();
log.WriteInfo("An INFO log event message appearing in Datadog's message column");
Dynamic enrichtments
Send a Datadog log event with a dynamic enrichment. Dynamic enrichments get removed/reset after each Write operation:
Stopwatch sw = Stopwatch.StartNew();
// do a thing
sw.Stop();
Log log = DDLog.Create();
log
.EnrichDynamic("responseTime", sw.ElapsedMilliseconds)
.WriteInfo("An INFO log event message appearing in Datadog's message column");
Static enrichments
Send a Datadog log event with a static enrichment. Static enrichments do not get removed after each Write operation. Can be used in combination with Dynamic enrichtments:
Log log = DDLog.Create();
log.EnrichStatic("network", "source-network");
log
.EnrichDynamic("someField", someVariable)
.WriteInfo("An INFO log event message appearing in Datadog's message column");
Log levels
You can set the log level and calling the appropriate Write***
function will log messages accordingly:
Log log = DDLog.Create();
log.SetLogLevel(LogLevel.Error); // only errors and up
log.WriteInfo("Hello world"); // will NOT be processed
log.WriteFatal("Ack, mein leben!"); // will be processed
Log event dispatching
The Datadog logger uses a background Task to dispatch log events in batches. By default a batch contains a maximum of 10 log events and each a maximum age of 5 seconds before being forcibly dispatched regardless of how many items a batch contains.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- System.Configuration.ConfigurationManager (>= 7.0.0)
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 | |
---|---|---|---|
0.5.0 | 394 | 2/19/2023 | |
0.4.5 | 242 | 2/19/2023 | |
0.4.4 | 255 | 2/17/2023 | |
0.4.3 | 239 | 2/17/2023 | |
0.4.2 | 242 | 2/17/2023 | |
0.4.1 | 246 | 2/17/2023 | |
0.4.0 | 236 | 2/17/2023 | |
0.4.0-beta1 | 128 | 2/17/2023 | |
0.3.1-beta1 | 143 | 9/30/2022 | |
0.2.4-beta1 | 144 | 8/17/2022 | |
0.2.3-beta1 | 145 | 8/17/2022 | |
0.2.1-beta1 | 142 | 8/17/2022 | |
0.2.0-beta1 | 144 | 8/15/2022 | |
0.1.2-beta1 | 130 | 8/15/2022 | |
0.1.1-beta1 | 140 | 8/15/2022 | |
0.1.0-beta1 | 143 | 8/12/2022 |