Skip to content

Commit 0dc2fb5

Browse files
authored
Merge pull request #54 from serilog/dev
Release 2.2.0
2 parents f3c8d59 + c157e45 commit 0dc2fb5

18 files changed

+411
-258
lines changed

.travis.yml

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,11 @@
11
language: csharp
22

3-
#dotnet cli require Ubuntu 14.04
4-
sudo: required
5-
dist: trusty
6-
7-
#dotnet cli require OSX 10.10
8-
osx_image: xcode7.1
9-
10-
addons:
11-
apt:
12-
packages:
13-
- gettext
14-
- libcurl4-openssl-dev
15-
- libicu-dev
16-
- libssl-dev
17-
- libunwind8
18-
- zlib1g
19-
20-
os:
21-
#- osx
22-
- linux
23-
24-
env:
25-
matrix:
26-
- CLI_VERSION=1.0.0-preview2-003121
27-
# - CLI_VERSION=Latest
28-
293
matrix:
30-
allow_failures:
31-
- env: CLI_VERSION=Latest
32-
33-
before_install:
34-
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi
35-
# Download script to install dotnet cli
36-
- if test "$CLI_OBTAIN_URL" == ""; then export CLI_OBTAIN_URL="https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh"; fi
37-
- curl -L --create-dirs $CLI_OBTAIN_URL -o ./scripts/obtain/install.sh
38-
- find ./scripts -name "*.sh" -exec chmod +x {} \;
39-
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
40-
# use bash to workaround bug https://github.com/dotnet/cli/issues/1725
41-
- sudo bash ./scripts/obtain/install.sh --channel "preview" --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" --no-path
42-
# add dotnet to PATH
43-
- export PATH="$DOTNET_INSTALL_DIR:$PATH"
4+
include:
5+
- os: linux # Ubuntu 14.04
6+
dist: trusty
7+
sudo: required
8+
dotnet: 1.0.4
449

4510
script:
4611
- ./build.sh

Build.ps1

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$ErrorActionPreference = "Stop"
12
echo "build: Build started"
23

34
Push-Location $PSScriptRoot
@@ -12,31 +13,24 @@ if(Test-Path .\artifacts) {
1213
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
1314
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
1415
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
16+
$commitHash = $(git rev-parse --short HEAD)
17+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
1518

16-
echo "build: Version suffix is $suffix"
19+
echo "build: Package version suffix is $suffix"
20+
echo "build: Build version suffix is $buildSuffix"
1721

1822
foreach ($src in ls src/*) {
1923
Push-Location $src
2024

2125
echo "build: Packaging project in $src"
2226

23-
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
27+
& dotnet build -c Release --version-suffix=$buildSuffix
28+
& dotnet pack -c Release --include-symbols -o ..\..\artifacts --version-suffix=$suffix --no-build
2429
if($LASTEXITCODE -ne 0) { exit 1 }
2530

2631
Pop-Location
2732
}
2833

29-
foreach ($test in ls test/*.PerformanceTests) {
30-
Push-Location $test
31-
32-
echo "build: Building performance test project in $test"
33-
34-
& dotnet build -c Release
35-
if($LASTEXITCODE -ne 0) { exit 2 }
36-
37-
Pop-Location
38-
}
39-
4034
foreach ($test in ls test/*.Tests) {
4135
Push-Location $test
4236

@@ -48,4 +42,6 @@ foreach ($test in ls test/*.Tests) {
4842
Pop-Location
4943
}
5044

45+
dotnet build -c Release .\sample\Sample\Sample.csproj
46+
5147
Pop-Location

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
##2.2.0
2+
- [#47] Tooling updates to VS2017
3+
14
##2.1.2
25
- [#43](https://github.com/serilog/serilog-sinks-splunk/pull/43) - Extend sink & static configuration to allow for custom JSON formatter.
36

appveyor.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2015
3+
image: Visual Studio 2017
44
configuration: Release
5-
install:
6-
- ps: mkdir -Force ".\build\" | Out-Null
7-
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
8-
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
9-
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-003121'
10-
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
115
build_script:
126
- ps: ./Build.ps1
137
test: off
@@ -26,4 +20,4 @@ deploy:
2620
artifact: /Serilog.*\.nupkg/
2721
tag: v$(appveyor_build_version)
2822
on:
29-
branch: master
23+
branch: master

build.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
#!/bin/bash
22

3-
# Ensure any exit code exits TravisCI
4-
set -e
3+
set -e
54

5+
export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
6+
DotnetCliVersion=${CLI_VERSION:="1.0.1"}
7+
install_script_url=https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh
8+
curl -sSL $install_script_url | bash /dev/stdin --version "$DotnetCliVersion" --install-dir "$DOTNET_INSTALL_DIR"
9+
export PATH="$DOTNET_INSTALL_DIR:$PATH"
10+
11+
# See issue https://github.com/NuGet/Home/issues/2163
12+
ulimit -n 2048
13+
14+
dotnet --info
615
dotnet restore
7-
for path in src/*/project.json; do
8-
dirname="$(dirname "${path}")"
9-
dotnet build ${dirname}
10-
done
1116

12-
for path in sample/project.json; do
13-
dirname="$(dirname "${path}")"
14-
dotnet build ${dirname}
15-
done
17+
for path in src/**/*.csproj; do
18+
dotnet build -f netstandard1.1 -c Release ${path}
19+
done
20+
21+
for path in test/*.Tests/*.csproj; do
22+
dotnet test -f netcoreapp1.0 -c Release ${path}
23+
done
1624

17-
for path in test/Serilog.Sinks.Splunk.Tests/project.json; do
18-
dirname="$(dirname "${path}")"
19-
dotnet build ${dirname} -f netcoreapp1.0 -c Release
20-
dotnet test ${dirname} -f netcoreapp1.0 -c Release
21-
done
25+
dotnet build -f netcoreapp1.0 -c Release sample/Sample/Sample.csproj

global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

sample/Program.cs renamed to sample/Sample/Program.cs

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
using System.Linq;
2-
using System.Threading;
32
using Serilog;
4-
using Serilog.Core;
3+
using Serilog.Sinks.Splunk;
54

65
namespace Sample
76
{
8-
///
9-
/// Sample 10 false
10-
///
117
public class Program
128
{
139
public static string EventCollectorToken = "2B94855F-1184-46F7-BFF1-56A3112F627E";
14-
10+
1511
public static void Main(string[] args)
1612
{
1713
var eventsToCreate = 100;
1814
var runSSL = false;
19-
20-
if(args.Length > 0)
21-
eventsToCreate = int.Parse(args[0]);
22-
23-
if(args.Length == 2)
24-
runSSL = bool.Parse(args[1]);
15+
16+
if (args.Length > 0)
17+
eventsToCreate = int.Parse(args[0]);
18+
19+
if (args.Length == 2)
20+
runSSL = bool.Parse(args[1]);
2521

2622
Log.Information("Sample starting up");
2723
Serilog.Debugging.SelfLog.Enable(System.Console.Out);
@@ -32,27 +28,49 @@ public static void Main(string[] args)
3228
OverridingSourceType(eventsToCreate);
3329
OverridingHost(eventsToCreate);
3430
WithNoTemplate(eventsToCreate);
35-
36-
if(runSSL)
31+
WithCompactSplunkFormatter(eventsToCreate);
32+
if (runSSL)
3733
UsingSSL(eventsToCreate);
38-
34+
3935
Log.Debug("Done");
4036
}
4137

38+
private static void WithCompactSplunkFormatter(int eventsToCreate)
39+
{
40+
// Vanilla Test with full uri specified
41+
Log.Logger = new LoggerConfiguration()
42+
.MinimumLevel.Debug()
43+
.WriteTo.LiterateConsole()
44+
.WriteTo.EventCollector(
45+
"http://localhost:8088/services/collector",
46+
Program.EventCollectorToken,new CompactSplunkJsonFormatter())
47+
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
48+
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla with CompactSplunkJsonFormatter specified")
49+
.CreateLogger();
50+
51+
52+
foreach (var i in Enumerable.Range(0, eventsToCreate))
53+
{
54+
Log.Information("{Counter}{Message}", i, "Running vanilla loop with CompactSplunkJsonFormatter");
55+
}
56+
57+
Log.CloseAndFlush();
58+
}
59+
4260
public static void OverridingSource(int eventsToCreate)
4361
{
4462
// Override Source
4563
Log.Logger = new LoggerConfiguration()
4664
.MinimumLevel.Debug()
47-
.WriteTo.LiterateConsole()
65+
.WriteTo.LiterateConsole()
4866
.WriteTo.EventCollector(
49-
"http://localhost:8088",
67+
"http://localhost:8088",
5068
Program.EventCollectorToken,
5169
source: "Serilog.Sinks.Splunk.Sample.TestSource")
5270
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
5371
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Source Override")
5472
.CreateLogger();
55-
73+
5674
foreach (var i in Enumerable.Range(0, eventsToCreate))
5775
{
5876
Log.Information("Running source override loop {Counter}", i);
@@ -67,15 +85,15 @@ public static void OverridingSourceType(int eventsToCreate)
6785
// Override Source
6886
Log.Logger = new LoggerConfiguration()
6987
.MinimumLevel.Debug()
70-
.WriteTo.LiterateConsole()
88+
.WriteTo.LiterateConsole()
7189
.WriteTo.EventCollector(
72-
"http://localhost:8088",
90+
"http://localhost:8088",
7391
Program.EventCollectorToken,
7492
sourceType: "Serilog.Sinks.Splunk.Sample.TestSourceType")
7593
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
7694
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Source Type Override")
7795
.CreateLogger();
78-
96+
7997
foreach (var i in Enumerable.Range(0, eventsToCreate))
8098
{
8199
Log.Information("Running source type override loop {Counter}", i);
@@ -90,15 +108,15 @@ public static void OverridingHost(int eventsToCreate)
90108
// Override Host
91109
Log.Logger = new LoggerConfiguration()
92110
.MinimumLevel.Debug()
93-
.WriteTo.LiterateConsole()
111+
.WriteTo.LiterateConsole()
94112
.WriteTo.EventCollector(
95-
"http://localhost:8088",
113+
"http://localhost:8088",
96114
Program.EventCollectorToken,
97115
host: "myamazingmachine")
98116
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
99117
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Host Override")
100118
.CreateLogger();
101-
119+
102120
foreach (var i in Enumerable.Range(0, eventsToCreate))
103121
{
104122
Log.Information("Running host override loop {Counter}", i);
@@ -113,7 +131,7 @@ public static void UsingFullUri(int eventsToCreate)
113131
// Vanilla Test with full uri specified
114132
Log.Logger = new LoggerConfiguration()
115133
.MinimumLevel.Debug()
116-
.WriteTo.LiterateConsole()
134+
.WriteTo.LiterateConsole()
117135
.WriteTo.EventCollector(
118136
"http://localhost:8088/services/collector",
119137
Program.EventCollectorToken)
@@ -135,13 +153,13 @@ public static void UsingHostOnly(int eventsToCreate)
135153
// Vanilla Tests just host
136154
Log.Logger = new LoggerConfiguration()
137155
.MinimumLevel.Debug()
138-
.WriteTo.LiterateConsole()
156+
.WriteTo.LiterateConsole()
139157
.WriteTo.EventCollector(
140158
"http://localhost:8088",
141159
Program.EventCollectorToken)
142160
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
143161
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla No services/collector in uri")
144-
.CreateLogger();
162+
.CreateLogger();
145163

146164
foreach (var i in Enumerable.Range(0, eventsToCreate))
147165
{
@@ -156,15 +174,15 @@ public static void WithNoTemplate(int eventsToCreate)
156174
// No Template
157175
Log.Logger = new LoggerConfiguration()
158176
.MinimumLevel.Debug()
159-
.WriteTo.LiterateConsole()
177+
.WriteTo.LiterateConsole()
160178
.WriteTo.EventCollector(
161-
"http://localhost:8088",
179+
"http://localhost:8088",
162180
Program.EventCollectorToken,
163181
renderTemplate: false)
164182
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
165183
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "No Templates")
166184
.CreateLogger();
167-
185+
168186
foreach (var i in Enumerable.Range(0, eventsToCreate))
169187
{
170188
Log.Information("Running no template loop {Counter}", i);
@@ -178,14 +196,14 @@ public static void UsingSSL(int eventsToCreate)
178196
// SSL
179197
Log.Logger = new LoggerConfiguration()
180198
.MinimumLevel.Debug()
181-
.WriteTo.LiterateConsole()
199+
.WriteTo.LiterateConsole()
182200
.WriteTo.EventCollector(
183201
"https://localhost:8088",
184202
Program.EventCollectorToken)
185203
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
186204
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "HTTPS")
187-
.CreateLogger();
188-
205+
.CreateLogger();
206+
189207
foreach (var i in Enumerable.Range(0, eventsToCreate))
190208
{
191209
Log.Information("HTTPS {Counter}", i);

sample/Sample/Sample.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Serilog" Version="2.4.0" />
10+
<PackageReference Include="Serilog.Sinks.Literate" Version="2.1.0" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\src\Serilog.Sinks.Splunk\Serilog.Sinks.Splunk.csproj" />
15+
</ItemGroup>
16+
17+
</Project>

0 commit comments

Comments
 (0)