Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ namespace Serilog.Extensions.Logging
/// <summary>
/// An <see cref="ILoggerProvider"/> that pipes events through Serilog.
/// </summary>
#if LOGGING_BUILDER
[ProviderAlias("Serilog")]
#endif
public class SerilogLoggerProvider : ILoggerProvider, ILogEventEnricher
{
internal const string OriginalFormatPropertyName = "{OriginalFormat}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'net46' or '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.0.0" />

<Compile Remove="SerilogLoggingBuilderExtensions.cs" />
<None Include="SerilogLoggingBuilderExtensions.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netstandard2.0' ">
Expand All @@ -39,15 +36,15 @@
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<DefineConstants>$(DefineConstants);ASYNCLOCAL</DefineConstants>
<DefineConstants>$(DefineConstants);ASYNCLOCAL;LOGGING_BUILDER</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<DefineConstants>$(DefineConstants);ASYNCLOCAL</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);ASYNCLOCAL</DefineConstants>
<DefineConstants>$(DefineConstants);ASYNCLOCAL;LOGGING_BUILDER</DefineConstants>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
#if LOGGING_BUILDER

using System;
using Microsoft.Extensions.Logging;
using Serilog.Extensions.Logging;

Expand All @@ -23,8 +25,10 @@ public static ILoggingBuilder AddSerilog(this ILoggingBuilder builder, ILogger l
if (builder == null) throw new ArgumentNullException(nameof(builder));

builder.AddProvider(new SerilogLoggerProvider(logger, dispose));
builder.AddFilter<SerilogLoggerProvider>(null, LogLevel.Trace);

return builder;
}
}
}
#endif // LOGGING_BUILDER