NLog.Targets.Nats 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package NLog.Targets.Nats --version 1.0.4
                    
NuGet\Install-Package NLog.Targets.Nats -Version 1.0.4
                    
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="NLog.Targets.Nats" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NLog.Targets.Nats" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="NLog.Targets.Nats" />
                    
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 NLog.Targets.Nats --version 1.0.4
                    
#r "nuget: NLog.Targets.Nats, 1.0.4"
                    
#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.
#addin nuget:?package=NLog.Targets.Nats&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=NLog.Targets.Nats&version=1.0.4
                    
Install as a Cake Tool

NLog.Targets.Nats NuGet Release

NLog custom target for NATS messaging server

Options

Name Description
NatsUrl URL for the Nats Connecttion
Subject Subject for the Nats message
Layout Payload for the Nats message
Headers Custom headers for the Nats message

Example NLog.config file

<nlog>
	<extensions>
		<add assembly="NLog.Targets.Nats" />
	</extensions>

	<targets>
		<target type="Nats" name="nats" NatsUrl="nats://localhost:4222" Subject="logs">
			<layout>${longdate} ${level} ${message} ${exception}</layout>
		</target>
	</targets>

	<rules>
		<logger name="*" minlevel="Info" writeTo="nats" />
	</rules>
</nlog>

Example NLog.config file with custom nats header

<nlog>
	<extensions>
		<add assembly="NLog.Targets.Nats" />
	</extensions>

	<targets>
		<target xsi:type="Nats" name="nats" NatsUrl="nats://localhost:4222" Subject="logs" headers='{"Custom_Header":"Custom Header Value"}'>
		  <layout>${longdate} ${level} || ${level} || ${message} ${exception}</layout>
		</target>
	</targets>

	<rules>
		<logger name="*" minlevel="Info" writeTo="nats" />
	</rules>
</nlog>
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
1.0.6 1,150 5/7/2025
1.0.5 263 3/12/2025
1.0.4 137 1/3/2025
1.0.3 686 12/13/2024
1.0.2 103 11/22/2024
1.0.1 165 9/3/2024
1.0.0 2,312 7/10/2024