-
Notifications
You must be signed in to change notification settings - Fork 149
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 #297 from serilog/dev
Creating release 5.5.0
- Loading branch information
Showing
85 changed files
with
3,036 additions
and
697 deletions.
There are no files selected for viewing
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
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: 12 additions & 0 deletions
12
sample/NetStandardDemo/NetStandardDemoApp/NetStandardDemoApp.csproj
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>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\NetStandardDemoLib\NetStandardDemoLib.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,23 @@ | ||
using System; | ||
using System.Threading; | ||
using NetStandardDemoLib; | ||
using Serilog; | ||
|
||
namespace NetStandardDemoApp | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main() | ||
{ | ||
Log.Logger = Initializer.CreateLoggerConfiguration().CreateLogger(); | ||
|
||
Log.Debug("Getting started"); | ||
|
||
Log.Information("Hello {Name} from thread {ThreadId}", Environment.GetEnvironmentVariable("USERNAME"), Thread.CurrentThread.ManagedThreadId); | ||
|
||
Log.Warning("No coins remain at position {@Position}", new { Lat = 25, Long = 134 }); | ||
|
||
Log.CloseAndFlush(); | ||
} | ||
} | ||
} |
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,62 @@ | ||
using System.Collections.ObjectModel; | ||
using System.Data; | ||
using Serilog; | ||
using Serilog.Events; | ||
using Serilog.Sinks.MSSqlServer; | ||
using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options; | ||
|
||
namespace NetStandardDemoLib | ||
{ | ||
public static class Initializer | ||
{ | ||
private const string _connectionString = "Server=localhost;Database=LogTest;Integrated Security=SSPI;"; | ||
private const string _tableName = "LogEvents"; | ||
|
||
public static LoggerConfiguration CreateLoggerConfiguration() | ||
{ | ||
return new LoggerConfiguration() | ||
.Enrich.FromLogContext() | ||
.WriteTo.MSSqlServer( | ||
_connectionString, | ||
new SinkOptions | ||
{ | ||
TableName = _tableName, | ||
AutoCreateSqlTable = true | ||
}, | ||
sinkOptionsSection: null, | ||
appConfiguration: null, | ||
restrictedToMinimumLevel: LevelAlias.Minimum, | ||
formatProvider: null, | ||
columnOptions: BuildColumnOptions(), | ||
columnOptionsSection: null, | ||
logEventFormatter: null); | ||
|
||
} | ||
|
||
private static ColumnOptions BuildColumnOptions() | ||
{ | ||
var columnOptions = new ColumnOptions | ||
{ | ||
TimeStamp = | ||
{ | ||
ColumnName = "TimeStampUTC", | ||
ConvertToUtc = true, | ||
}, | ||
|
||
AdditionalColumns = new Collection<SqlColumn> | ||
{ | ||
new SqlColumn { DataType = SqlDbType.NVarChar, ColumnName = "MachineName" }, | ||
new SqlColumn { DataType = SqlDbType.NVarChar, ColumnName = "ProcessName" }, | ||
new SqlColumn { DataType = SqlDbType.NVarChar, ColumnName = "ThreadId" }, | ||
new SqlColumn { DataType = SqlDbType.NVarChar, ColumnName = "CallerName" }, | ||
new SqlColumn { DataType = SqlDbType.NVarChar, ColumnName = "SourceFile" }, | ||
new SqlColumn { DataType = SqlDbType.NVarChar, ColumnName = "LineNumber" } | ||
} | ||
}; | ||
|
||
columnOptions.Store.Remove(StandardColumn.Properties); | ||
|
||
return columnOptions; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
sample/NetStandardDemo/NetStandardDemoLib/NetStandardDemoLib.csproj
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
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.