-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from serilog/dev
Update Dev
- Loading branch information
Showing
33 changed files
with
455 additions
and
463 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
results/netcoreapp3.1/SourceContextMatchBenchmark-report-github.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Benchmark results | ||
|
||
## Linux | ||
|
||
``` ini | ||
|
||
BenchmarkDotNet=v0.12.0, OS=debian 11 | ||
Intel Core i7-3840QM CPU 2.80GHz (Ivy Bridge), 1 CPU, 4 logical and 2 physical cores | ||
.NET Core SDK=3.1.201 | ||
[Host] : .NET Core 3.1.3 (CoreCLR 4.700.20.11803, CoreFX 4.700.20.12001), X64 RyuJIT | ||
Job-CSERBI : .NET Core 2.1.16 (CoreCLR 4.6.28516.03, CoreFX 4.6.28516.10), X64 RyuJIT | ||
Job-GDNCBZ : .NET Core 3.1.3 (CoreCLR 4.700.20.11803, CoreFX 4.700.20.12001), X64 RyuJIT | ||
|
||
|
||
``` | ||
| Method | Runtime | Mean | Error | StdDev | Ratio | | ||
|----------------------------------- |-------------- |-----------:|---------:|---------:|------:| | ||
| Filter_MatchingFromSource | .NET Core 2.1 | 5,799.5 ns | 51.17 ns | 45.36 ns | 1.00 | | ||
| Filter_MatchingFromSource | .NET Core 3.1 | 3,564.5 ns | 37.43 ns | 35.01 ns | 0.61 | | ||
| | | | | | | | ||
| Logger_ForContext | .NET Core 2.1 | 2,519.0 ns | 15.37 ns | 13.62 ns | 1.00 | | ||
| Logger_ForContext | .NET Core 3.1 | 961.8 ns | 4.67 ns | 4.36 ns | 0.38 | | ||
| | | | | | | | ||
| LevelOverrideMap_GetEffectiveLevel | .NET Core 2.1 | 1,745.7 ns | 11.95 ns | 10.60 ns | 1.00 | | ||
| LevelOverrideMap_GetEffectiveLevel | .NET Core 3.1 | 193.8 ns | 2.35 ns | 2.20 ns | 0.11 | | ||
|
||
## Windows | ||
|
||
``` ini | ||
|
||
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.19041 | ||
Intel Core i7-3840QM CPU 2.80GHz (Ivy Bridge), 1 CPU, 8 logical and 4 physical cores | ||
.NET Core SDK=3.1.300 | ||
[Host] : .NET Core 3.1.4 (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT | ||
Job-KEWXME : .NET Core 2.1.16 (CoreCLR 4.6.28516.03, CoreFX 4.6.28516.10), X64 RyuJIT | ||
Job-KKEVOV : .NET Core 3.1.4 (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT | ||
|
||
|
||
``` | ||
| Method | Runtime | Mean | Error | StdDev | Ratio | | ||
|----------------------------------- |-------------- |-----------:|----------:|----------:|------:| | ||
| Filter_MatchingFromSource | .NET Core 2.1 | 8,088.7 ns | 120.48 ns | 112.70 ns | 1.00 | | ||
| Filter_MatchingFromSource | .NET Core 3.1 | 3,369.0 ns | 71.49 ns | 73.42 ns | 0.42 | | ||
| | | | | | | | ||
| Logger_ForContext | .NET Core 2.1 | 6,322.1 ns | 98.18 ns | 91.84 ns | 1.00 | | ||
| Logger_ForContext | .NET Core 3.1 | 785.6 ns | 9.05 ns | 8.47 ns | 0.12 | | ||
| | | | | | | | ||
| LevelOverrideMap_GetEffectiveLevel | .NET Core 2.1 | 5,619.1 ns | 20.98 ns | 18.60 ns | 1.00 | | ||
| LevelOverrideMap_GetEffectiveLevel | .NET Core 3.1 | 185.4 ns | 1.63 ns | 1.44 ns | 0.03 | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
src/Serilog/Core/CustomDefaultMethodImplementationAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
namespace Serilog.Core | ||
{ | ||
#if FEATURE_DEFAULT_INTERFACE | ||
using System; | ||
|
||
using System; | ||
|
||
namespace Serilog.Core | ||
{ | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Interface)] | ||
internal sealed class CustomDefaultMethodImplementationAttribute : Attribute | ||
sealed class CustomDefaultMethodImplementationAttribute : Attribute | ||
{ | ||
} | ||
#endif | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2020 Serilog Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Serilog.Events; | ||
using System; | ||
|
||
namespace Serilog.Core.Sinks | ||
{ | ||
class DisposeDelegatingSink : ILogEventSink, IDisposable | ||
{ | ||
readonly ILogEventSink _sink; | ||
readonly IDisposable _disposable; | ||
|
||
public DisposeDelegatingSink(ILogEventSink sink, IDisposable disposable) | ||
{ | ||
_sink = sink ?? throw new ArgumentNullException(nameof(sink)); | ||
_disposable = disposable ?? throw new ArgumentNullException(nameof(disposable)); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_disposable.Dispose(); | ||
} | ||
|
||
public void Emit(LogEvent logEvent) | ||
{ | ||
_sink.Emit(logEvent); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2020 Serilog Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Serilog.Debugging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Serilog.Events; | ||
|
||
namespace Serilog.Core.Sinks | ||
{ | ||
class DisposingAggregateSink : ILogEventSink, IDisposable | ||
{ | ||
readonly ILogEventSink[] _sinks; | ||
|
||
public DisposingAggregateSink(IEnumerable<ILogEventSink> sinks) | ||
{ | ||
if (sinks == null) throw new ArgumentNullException(nameof(sinks)); | ||
_sinks = sinks.ToArray(); | ||
} | ||
|
||
public void Emit(LogEvent logEvent) | ||
{ | ||
List<Exception> exceptions = null; | ||
foreach (var sink in _sinks) | ||
{ | ||
try | ||
{ | ||
sink.Emit(logEvent); | ||
} | ||
catch (Exception ex) | ||
{ | ||
SelfLog.WriteLine("Caught exception while emitting to sink {0}: {1}", sink, ex); | ||
exceptions ??= new List<Exception>(); | ||
exceptions.Add(ex); | ||
} | ||
} | ||
|
||
if (exceptions != null) | ||
throw new AggregateException("Failed to emit a log event.", exceptions); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
if (_sinks == null) return; | ||
|
||
foreach (var sink in _sinks) | ||
{ | ||
if (!(sink is IDisposable disposable)) continue; | ||
|
||
try | ||
{ | ||
disposable.Dispose(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
SelfLog.WriteLine("Caught exception while disposing sink {0}: {1}", sink, ex); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.