Skip to content

Commit bdadace

Browse files
authored
Merge pull request #82 from serilog/dev
4.0.0 Release
2 parents e43ff81 + 9f26947 commit bdadace

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+861
-294
lines changed

.idea/.idea.serilog-sinks-console/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.serilog-sinks-console/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.serilog-sinks-console/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.serilog-sinks-console/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ language: csharp
33
matrix:
44
include:
55
- os: linux # Ubuntu 14.04
6-
dist: trusty
6+
dist: xenial
77
sudo: required
8-
dotnet: 1.0.4
8+
dotnet: 2.2.401
9+
mono: none
910
group: edge
1011

1112
script:

Build.ps1

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
echo "build: Build started"
1+
Write-Output "build: Build started"
2+
3+
& dotnet --info
4+
& dotnet --list-sdks
25

36
Push-Location $PSScriptRoot
47

58
if(Test-Path .\artifacts) {
6-
echo "build: Cleaning .\artifacts"
9+
Write-Output "build: Cleaning .\artifacts"
710
Remove-Item .\artifacts -Force -Recurse
811
}
912

1013
& dotnet restore --no-cache
1114

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

18-
echo "build: Package version suffix is $suffix"
19-
echo "build: Build version suffix is $buildSuffix"
21+
Write-Output "build: Package version suffix is $suffix"
22+
Write-Output "build: Build version suffix is $buildSuffix"
2023

21-
foreach ($src in ls src/*) {
24+
foreach ($src in Get-ChildItem src/*) {
2225
Push-Location $src
2326

24-
echo "build: Packaging project in $src"
27+
Write-Output "build: Packaging project in $src"
2528

2629
& dotnet build -c Release --version-suffix=$buildSuffix
2730
if ($suffix) {
@@ -34,10 +37,21 @@ foreach ($src in ls src/*) {
3437
Pop-Location
3538
}
3639

37-
foreach ($test in ls test/*.Tests) {
40+
foreach ($sample in Get-ChildItem sample/*) {
41+
Push-Location $sample
42+
43+
Write-Output "build: Testing project in $sample"
44+
45+
& dotnet build -c Release --version-suffix=$buildSuffix
46+
if($LASTEXITCODE -ne 0) { exit 3 }
47+
48+
Pop-Location
49+
}
50+
51+
foreach ($test in Get-ChildItem test/*.Tests) {
3852
Push-Location $test
3953

40-
echo "build: Testing project in $test"
54+
Write-Output "build: Testing project in $test"
4155

4256
& dotnet test -c Release
4357
if($LASTEXITCODE -ne 0) { exit 3 }

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Code of Conduct
22

3-
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.
3+
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.

README.md

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ A Serilog sink that writes log events to the Windows Console or an ANSI terminal
66

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

9-
```powershell
10-
Install-Package Serilog.Sinks.Console
9+
```shell
10+
dotnet add package Serilog.Sinks.Console
1111
```
1212

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

6565
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:
6666

67-
```powershell
68-
Install-Package Serilog.Formatting.Compact
67+
```shell
68+
dotnet add package Serilog.Formatting.Compact
6969
```
7070

7171
Pass a formatter to the `Console()` configuration method:
7272

7373
```csharp
74-
.WriteTo.Console(new CompactJsonFormatter())
74+
.WriteTo.Console(new RenderedCompactJsonFormatter())
7575
```
7676

7777
Output theming is not available when custom formatters are used.
@@ -80,8 +80,8 @@ Output theming is not available when custom formatters are used.
8080

8181
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:
8282

83-
```powershell
84-
Install-Package Serilog.Settings.AppSettings
83+
```shell
84+
dotnet add package Serilog.Settings.AppSettings
8585
```
8686

8787
Instead of configuring the logger in code, call `ReadFrom.AppSettings()`:
@@ -101,12 +101,21 @@ In your application's `App.config` or `Web.config` file, specify the console sin
101101
<add key="serilog:write-to:Console" />
102102
```
103103

104+
To configure the console sink with a different theme and include the `SourceContext` in the output, change your `App.config`/`Web.config` to:
105+
```xml
106+
<configuration>
107+
<appSettings>
108+
<add key="serilog:using:Console" value="Serilog.Sinks.Console" />
109+
<add key="serilog:write-to:Console.theme" value="Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console" />
110+
<add key="serilog:write-to:Console.outputTemplate" value="[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} &lt;s:{SourceContext}&gt;{NewLine}{Exception}" />
111+
```
112+
104113
### JSON `appsettings.json` configuration
105114

106115
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:
107116

108-
```powershell
109-
Install-Package Serilog.Settings.Configuration
117+
```shell
118+
dotnet add package Serilog.Settings.Configuration
110119
```
111120

112121
Instead of configuring the sink directly in code, call `ReadFrom.Configuration()`:
@@ -122,7 +131,6 @@ var logger = new LoggerConfiguration()
122131
```
123132

124133
In your `appsettings.json` file, under the `Serilog` node, :
125-
126134
```json
127135
{
128136
"Serilog": {
@@ -131,18 +139,23 @@ In your `appsettings.json` file, under the `Serilog` node, :
131139
}
132140
```
133141

134-
### Upgrading from _Serilog.Sinks.Console_ 2.x
135-
136-
To achieve output identical to version 2 of this sink, specify a formatter and output template explicitly:
137-
138-
```csharp
139-
.WriteTo.Console(new MessageTemplateTextFormatter(
140-
"{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}",
141-
null))
142+
To configure the console sink with a different theme and include the `SourceContext` in the output, change your `appsettings.json` to:
143+
```json
144+
{
145+
"Serilog": {
146+
"WriteTo": [
147+
{
148+
"Name": "Console",
149+
"Args": {
150+
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
151+
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
152+
}
153+
}
154+
]
155+
}
156+
}
142157
```
143158

144-
This will bypass theming and use Serilog's built-in message template formatting.
145-
146159
### Contributing
147160

148161
Would you like to help make the Serilog console sink even better? We keep a list of issues that are approachable for newcomers under the [up-for-grabs](https://github.com/serilog/serilog-sinks-console/issues?labels=up-for-grabs&state=open) label. Before starting work on a pull request, we suggest commenting on, or raising, an issue on the issue tracker so that we can help and coordinate efforts. For more details check out our [contributing guide](CONTRIBUTING.md).
@@ -155,7 +168,7 @@ When contributing please keep in mind our [Code of Conduct](CODE_OF_CONDUCT.md).
155168
Branch | AppVeyor | Travis
156169
------------- | ------------- |-------------
157170
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)
158-
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)
171+
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)
159172

160173

161-
_Copyright &copy; 2017 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._
174+
_Copyright &copy; Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._

appveyor.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2017
4-
configuration: Release
3+
image: Visual Studio 2019
54
test: off
65
build_script:
76
- ps: ./Build.ps1
@@ -10,14 +9,14 @@ artifacts:
109
deploy:
1110
- provider: NuGet
1211
api_key:
13-
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
12+
secure: rbdBqxBpLt4MkB+mrDOYNDOd8aVZ1zMkysaVNAXNKnC41FYifzX3l9LM8DCrUWU5
1413
skip_symbols: true
1514
on:
16-
branch: /^(master|dev)$/
15+
branch: /^(main|dev)$/
1716
- provider: GitHub
1817
auth_token:
1918
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
2019
artifact: /Serilog.*\.nupkg/
2120
tag: v$(appveyor_build_version)
2221
on:
23-
branch: master
22+
branch: main

assets/icon.png

19.9 KB
Loading

0 commit comments

Comments
 (0)