Skip to content

Commit

Permalink
Version 5.2 (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot authored Oct 15, 2023
1 parent 4298097 commit c57e535
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ NLog DiagnosticListenerTarget for [Microsoft DiagnosticSource](https://github.co
</extensions>
```

Alternative register from code using fluent configuration API:
```csharp
LogManager.Setup().SetupExtensions(ext => {
ext.RegisterTarget<NLog.Targets.DiagnosticListenerTarget>();
ext.RegisterLayoutRenderer<NLog.LayoutRenderers.ActivityTraceLayoutRenderer>();
});
```

### How to use ActivityTraceLayoutRenderer
The `System.Diagnostics.Activity.Current` from Microsoft allows one to create OpenTelemetry spans.
NLog can capture the span details together with the LogEvent by using `${activity}` like this:

Example of `NLog.config` file that outputs span-details together with LogEvent by using `${activity}`:

```xml
<nlog>
<extensions>
<add assembly="NLog.DiagnosticSource"/>
</extensions>
Expand All @@ -38,6 +48,7 @@ NLog can capture the span details together with the LogEvent by using `${activit
<rules>
<logger minLevel="Info" writeTo="console" />
</rules>
</nlog>
```

**Property Enum Values**
Expand Down Expand Up @@ -97,9 +108,10 @@ If creating a custom HostBuilder, then one have to manually setup the ActivityTr

### How to use DiagnosticListenerTarget

Use the target "diagnosticListener" in your nlog.config
Example of `NLog.config` file that uses the `diagnosticListener` target:

```xml
<nlog>
<extensions>
<add assembly="NLog.DiagnosticSource"/>
</extensions>
Expand All @@ -109,4 +121,5 @@ Use the target "diagnosticListener" in your nlog.config
<rules>
<logger minLevel="Info" writeTo="diagSource" />
</rules>
</nlog>
```
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ artifacts:
deploy:
- provider: NuGet
api_key:
secure: 5tuxbM+Ujp0ZtaDCGYET23qKr6bJWo/Vzxlf7uTbspaf8R1R7sIe1JqSDHZoK1gV
secure: ACKSV1ixxNpO+2k8KvNDy6hd9QmR8lkQmKn773ZIIeVpG0ywYUhY4j8LcyykVR1a
on:
branch: master
26 changes: 13 additions & 13 deletions src/NLog.DiagnosticSource/NLog.DiagnosticSource.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net60;net461;netstandard2.0</TargetFrameworks>
<RootNamespace>NLog</RootNamespace>
<VersionPrefix>5.0.0</VersionPrefix>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>

<AssemblyVersion>5.0.0.0</AssemblyVersion>
Expand All @@ -23,10 +23,10 @@
<PackageIcon>N.png</PackageIcon>
<PackageProjectUrl>https://github.com/NLog/NLog.DiagnosticSource</PackageProjectUrl>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>
Removed target platform NET5 and replaced with NET6
Updated to System.Diagnostics.DiagnosticSource v6
Updated to NLog v5
- Updated to NLog v5.2.2
- Updated nuget-package with README.md

See https://github.com/NLog/NLog.DiagnosticSource for documentation of ${activity} and DiagnosticListenerTarget
</PackageReleaseNotes>
Expand All @@ -39,21 +39,21 @@ See https://github.com/NLog/NLog.DiagnosticSource for documentation of ${activit
<DelaySign>false</DelaySign>
</PropertyGroup>

<Target Name="DownloadMissingContent" BeforeTargets="GenerateNuspec">
<DownloadFile SourceUrl="https://nlog-project.org/N.png" DestinationFolder="$(MSBuildThisFileDirectory)" />
</Target>

<ItemGroup>
<None Include="N.png" Pack="true" PackagePath="" Visible="false" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NLog" Version="5.0.5" />
<PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'!='net60'">
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<None Include="../../README.md" Pack="true" PackagePath="" />
<None Include="N.png" Pack="true" PackagePath="" Visible="false" />
</ItemGroup>
<Target Name="DownloadMissingContent" BeforeTargets="GenerateNuspec">
<DownloadFile SourceUrl="https://nlog-project.org/N.png" DestinationFolder="$(MSBuildThisFileDirectory)" />
</Target>

</Project>

0 comments on commit c57e535

Please sign in to comment.