Skip to content

Commit

Permalink
Updated to NLog 5 preview 2 to fix unit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot committed Oct 3, 2021
1 parent c964fd2 commit 4ab0b27
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace NLog.Extensions.Logging
/// </example>
[LayoutRenderer("configsetting")]
[ThreadAgnostic]
[ThreadSafe]
public class ConfigSettingLayoutRenderer : LayoutRenderer
{
private IConfiguration _serviceConfiguration;
Expand Down Expand Up @@ -77,6 +76,7 @@ protected override void InitializeLayoutRenderer()
}
catch (NLogDependencyResolveException ex)
{
_serviceConfiguration = null;
InternalLogger.Debug("ConfigSetting - IConfiguration could not be resolved, so fallback to DefaultConfiguration: {0}", ex.Message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace NLog.Extensions.Logging
/// Renders output that simulates simple Microsoft Console Logger. Useful for Hosting Lifetime Startup Messages.
/// </summary>
[LayoutRenderer("MicrosoftConsoleLayout")]
[ThreadSafe]
[ThreadAgnostic]
class MicrosoftConsoleLayoutRenderer : LayoutRenderer
{
Expand Down
2 changes: 1 addition & 1 deletion src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Full changelog: https://github.com/NLog/NLog.Extensions.Logging/blob/master/CHAN
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0-preview.1" />
<PackageReference Include="NLog" Version="5.0.0-preview.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
6 changes: 3 additions & 3 deletions test/NLog.Extensions.Logging.Tests/CustomBeginScopeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class CustomBeginScopeTest : NLogTestBase
public void TestNonSerializableSayHello()
{
var runner = GetRunner<CustomBeginScopeTestRunner>();
var target = new Targets.MemoryTarget { Layout = "${message} ${scopeproperty:World}. Welcome ${ndlc}" };
var target = new Targets.MemoryTarget { Layout = "${message} ${scopeproperty:World}. Welcome ${scopenested}" };
ConfigureNLog(target);
runner.SayHello().Wait();
Assert.Single(target.Logs);
Expand All @@ -24,7 +24,7 @@ public void TestNonSerializableSayHello()
public void TestNonSerializableSayHelloWithScope()
{
var runner = GetRunner<CustomBeginScopeTestRunner>(new NLogProviderOptions { IncludeScopes = false });
var target = new Targets.MemoryTarget { Layout = "${message} ${scopeproperty:World}. Welcome ${ndlc}" };
var target = new Targets.MemoryTarget { Layout = "${message} ${scopeproperty:World}. Welcome ${scopenested}" };
ConfigureNLog(target);
runner.SayHello().Wait();
Assert.Single(target.Logs);
Expand All @@ -35,7 +35,7 @@ public void TestNonSerializableSayHelloWithScope()
public void TestNonSerializableSayHi()
{
var runner = GetRunner<CustomBeginScopeTestRunner>();
var target = new Targets.MemoryTarget { Layout = "${message} ${scopeproperty:World}. Welcome ${ndlc}" };
var target = new Targets.MemoryTarget { Layout = "${message} ${scopeproperty:World}. Welcome ${scopenested}" };
ConfigureNLog(target);
var scopeString = runner.SayHi().Result;
Assert.Single(target.Logs);
Expand Down

0 comments on commit 4ab0b27

Please sign in to comment.