Skip to content

Commit

Permalink
Tidy up, fix build, add net5.0 targets, use the Nullable support package
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt committed Jul 12, 2021
1 parent ffc2c0f commit 9f26947
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 206 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.serilog-sinks-console/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.serilog-sinks-console/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.serilog-sinks-console/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.serilog-sinks-console/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(Test-Path .\artifacts) {

$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ A Serilog sink that writes log events to the Windows Console or an ANSI terminal

To use the console sink, first install the [NuGet package](https://nuget.org/packages/serilog.sinks.console):

```powershell
Install-Package Serilog.Sinks.Console
```shell
dotnet add package Serilog.Sinks.Console
```

Then enable the sink using `WriteTo.Console()`:
Expand Down Expand Up @@ -64,8 +64,8 @@ The default template, shown in the example above, uses built-in properties like

The sink can write JSON output instead of plain text. `CompactJsonFormatter` or `RenderedCompactJsonFormatter` from [Serilog.Formatting.Compact](https://github.com/serilog/serilog-formatting-compact) is recommended:

```powershell
Install-Package Serilog.Formatting.Compact
```shell
dotnet add package Serilog.Formatting.Compact
```

Pass a formatter to the `Console()` configuration method:
Expand All @@ -80,8 +80,8 @@ Output theming is not available when custom formatters are used.

To use the console sink with the [Serilog.Settings.AppSettings](https://github.com/serilog/serilog-settings-appsettings) package, first install that package if you haven't already done so:

```powershell
Install-Package Serilog.Settings.AppSettings
```shell
dotnet add package Serilog.Settings.AppSettings
```

Instead of configuring the logger in code, call `ReadFrom.AppSettings()`:
Expand Down Expand Up @@ -114,8 +114,8 @@ To configure the console sink with a different theme and include the `SourceCont

To use the console sink with _Microsoft.Extensions.Configuration_, for example with ASP.NET Core or .NET Core, use the [Serilog.Settings.Configuration](https://github.com/serilog/serilog-settings-configuration) package. First install that package if you have not already done so:

```powershell
Install-Package Serilog.Settings.Configuration
```shell
dotnet add package Serilog.Settings.Configuration
```

Instead of configuring the sink directly in code, call `ReadFrom.Configuration()`:
Expand Down Expand Up @@ -168,7 +168,7 @@ When contributing please keep in mind our [Code of Conduct](CODE_OF_CONDUCT.md).
Branch | AppVeyor | Travis
------------- | ------------- |-------------
dev | [![Build status](https://ci.appveyor.com/api/projects/status/w1w3m1wyk3in1c96/branch/dev?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-console/branch/dev) | [![Build Status](https://travis-ci.org/serilog/serilog-sinks-console.svg?branch=dev)](https://travis-ci.org/serilog/serilog-sinks-console)
master | [![Build status](https://ci.appveyor.com/api/projects/status/w1w3m1wyk3in1c96/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-console/branch/master) | [![Build Status](https://travis-ci.org/serilog/serilog-sinks-console.svg?branch=master)](https://travis-ci.org/serilog/serilog-sinks-console)
main | [![Build status](https://ci.appveyor.com/api/projects/status/w1w3m1wyk3in1c96/branch/main?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-console/branch/main) | [![Build Status](https://travis-ci.org/serilog/serilog-sinks-console.svg?branch=main)](https://travis-ci.org/serilog/serilog-sinks-console)


_Copyright © 2017 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._
_Copyright © Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._
7 changes: 3 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '{build}'
skip_tags: true
image: Visual Studio 2019
configuration: Release
test: off
build_script:
- ps: ./Build.ps1
Expand All @@ -10,14 +9,14 @@ artifacts:
deploy:
- provider: NuGet
api_key:
secure: N59tiJECUYpip6tEn0xvdmDAEiP9SIzyLEFLpwiigm/8WhJvBNs13QxzT1/3/JW/
secure: rbdBqxBpLt4MkB+mrDOYNDOd8aVZ1zMkysaVNAXNKnC41FYifzX3l9LM8DCrUWU5
skip_symbols: true
on:
branch: /^(master|dev)$/
branch: /^(main|dev)$/
- provider: GitHub
auth_token:
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
artifact: /Serilog.*\.nupkg/
tag: v$(appveyor_build_version)
on:
branch: master
branch: main
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sample/ConsoleDemo/ConsoleDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net452;net462;net472;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net452;net462;net472;net48;net5.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sample/ConsoleDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace ConsoleDemo
{
public class Program
public static class Program
{
public static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion sample/SyncWritesDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void SystemConsoleSyncTest(object syncRootForLogger1, object syncRootForL
.CreateLogger();

var options = new ParallelOptions { MaxDegreeOfParallelism = 8 };
System.Threading.Tasks.Parallel.For(0, 1000, options, (i, loopState) =>
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);
Expand Down
2 changes: 1 addition & 1 deletion sample/SyncWritesDemo/SyncWritesDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Serilog.Sinks.Console/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[assembly: CLSCompliant(true)]

[assembly: InternalsVisibleTo("Serilog.Sinks.SystemConsole.Tests, PublicKey=" +
[assembly: InternalsVisibleTo("Serilog.Sinks.Console.Tests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
Expand Down
18 changes: 8 additions & 10 deletions src/Serilog.Sinks.Console/Serilog.Sinks.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@
<Description>A Serilog sink that writes log events to the console/terminal.</Description>
<VersionPrefix>4.0.0</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0;</TargetFrameworks>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0;net5.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<AssemblyName>Serilog.Sinks.Console</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Serilog.Sinks.Console</PackageId>
<PackageTags>serilog;console;terminal</PackageTags>
<PackageIconUrl>http://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/serilog/serilog-sinks-console</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryUrl>https://github.com/serilog/serilog-sinks-console</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Don't reference the full NETStandard.Library -->
<DisableImplicitFrameworkReferences Condition=" '$(TargetFramework)' != 'netstandard2.0' ">true</DisableImplicitFrameworkReferences>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />
<RootNamespace>Serilog</RootNamespace>
Expand All @@ -33,7 +27,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Nullable" Version="1.3.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\assets\icon.png" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ public static void EnableVirtualTerminalProcessing()

[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetConsoleMode(IntPtr handle, uint mode);

}
}
140 changes: 0 additions & 140 deletions src/Serilog.Sinks.Console/Support/NullableAttributes..cs

This file was deleted.

19 changes: 0 additions & 19 deletions test/Serilog.Sinks.Console.Tests/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit 9f26947

Please sign in to comment.