-
Notifications
You must be signed in to change notification settings - Fork 72
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 #82 from serilog/dev
4.0.0 Release
- Loading branch information
Showing
51 changed files
with
861 additions
and
294 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Code of Conduct | ||
|
||
Please refer to the [Serilog Code of Conduct](https://github.com/serilog/serilog/blob/dev/CONTRIBUTING.md) which covers all repositories within the Serilog Organisation. | ||
Please refer to the [Serilog Code of Conduct](https://github.com/serilog/serilog/blob/dev/CODE_OF_CONDUCT.md) which covers all repositories within the Serilog Organization. |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,57 @@ | ||
using Serilog; | ||
using Serilog.Sinks.SystemConsole.Themes; | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace SyncWritesDemo | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
Console.WriteLine("A sample of how to sync writes to the console sink."); | ||
|
||
if (args != null && args.Length == 1) | ||
{ | ||
switch (args[0]) | ||
{ | ||
case "--sync-root-default": | ||
SystemConsoleSyncTest(syncRootForLogger1: null, syncRootForLogger2: null); | ||
return; | ||
case "--sync-root-separate": | ||
SystemConsoleSyncTest(syncRootForLogger1: new object(), syncRootForLogger2: new object()); | ||
return; | ||
case "--sync-root-same": | ||
var sameSyncRoot = new object(); | ||
SystemConsoleSyncTest(syncRootForLogger1: sameSyncRoot, syncRootForLogger2: sameSyncRoot); | ||
return; | ||
} | ||
} | ||
|
||
Console.WriteLine("Expecting one of the following arguments:{0}--sync-root-default{0}--sync-root-separate{0}--sync-root-same", Environment.NewLine); | ||
} | ||
|
||
static void SystemConsoleSyncTest(object syncRootForLogger1, object syncRootForLogger2) | ||
{ | ||
var logger1 = new LoggerConfiguration() | ||
.MinimumLevel.Verbose() | ||
.Enrich.WithProperty("Logger", "logger1") | ||
.WriteTo.Console(theme: SystemConsoleTheme.Literate, syncRoot: syncRootForLogger1) | ||
.CreateLogger(); | ||
|
||
var logger2 = new LoggerConfiguration() | ||
.MinimumLevel.Verbose() | ||
.Enrich.WithProperty("Logger", "logger2") | ||
.WriteTo.Console(theme: SystemConsoleTheme.Literate, syncRoot: syncRootForLogger2) | ||
.CreateLogger(); | ||
|
||
var options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; | ||
Parallel.For(0, 1000, options, (i, loopState) => | ||
{ | ||
var logger = (i % 2 == 0) ? logger1 : logger2; | ||
logger.Information("Event {Iteration} generated by {ThreadId}", i, Thread.CurrentThread.ManagedThreadId); | ||
}); | ||
} | ||
} | ||
} |
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,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Serilog.Sinks.Console\Serilog.Sinks.Console.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.