Skip to content

Commit

Permalink
Merge pull request #54 from serilog/dev
Browse files Browse the repository at this point in the history
Release 2.2.0
  • Loading branch information
merbla authored May 28, 2017
2 parents f3c8d59 + c157e45 commit 0dc2fb5
Show file tree
Hide file tree
Showing 18 changed files with 411 additions and 258 deletions.
45 changes: 5 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,11 @@
language: csharp

#dotnet cli require Ubuntu 14.04
sudo: required
dist: trusty

#dotnet cli require OSX 10.10
osx_image: xcode7.1

addons:
apt:
packages:
- gettext
- libcurl4-openssl-dev
- libicu-dev
- libssl-dev
- libunwind8
- zlib1g

os:
#- osx
- linux

env:
matrix:
- CLI_VERSION=1.0.0-preview2-003121
# - CLI_VERSION=Latest

matrix:
allow_failures:
- env: CLI_VERSION=Latest

before_install:
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi
# Download script to install dotnet cli
- 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
- curl -L --create-dirs $CLI_OBTAIN_URL -o ./scripts/obtain/install.sh
- find ./scripts -name "*.sh" -exec chmod +x {} \;
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
# use bash to workaround bug https://github.com/dotnet/cli/issues/1725
- sudo bash ./scripts/obtain/install.sh --channel "preview" --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" --no-path
# add dotnet to PATH
- export PATH="$DOTNET_INSTALL_DIR:$PATH"
include:
- os: linux # Ubuntu 14.04
dist: trusty
sudo: required
dotnet: 1.0.4

script:
- ./build.sh
22 changes: 9 additions & 13 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$ErrorActionPreference = "Stop"
echo "build: Build started"

Push-Location $PSScriptRoot
Expand All @@ -12,31 +13,24 @@ 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"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]

echo "build: Version suffix is $suffix"
echo "build: Package version suffix is $suffix"
echo "build: Build version suffix is $buildSuffix"

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

echo "build: Packaging project in $src"

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

Pop-Location
}

foreach ($test in ls test/*.PerformanceTests) {
Push-Location $test

echo "build: Building performance test project in $test"

& dotnet build -c Release
if($LASTEXITCODE -ne 0) { exit 2 }

Pop-Location
}

foreach ($test in ls test/*.Tests) {
Push-Location $test

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

dotnet build -c Release .\sample\Sample\Sample.csproj

Pop-Location
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
##2.2.0
- [#47] Tooling updates to VS2017

##2.1.2
- [#43](https://github.com/serilog/serilog-sinks-splunk/pull/43) - Extend sink & static configuration to allow for custom JSON formatter.

Expand Down
10 changes: 2 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
version: '{build}'
skip_tags: true
image: Visual Studio 2015
image: Visual Studio 2017
configuration: Release
install:
- ps: mkdir -Force ".\build\" | Out-Null
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-003121'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
build_script:
- ps: ./Build.ps1
test: off
Expand All @@ -26,4 +20,4 @@ deploy:
artifact: /Serilog.*\.nupkg/
tag: v$(appveyor_build_version)
on:
branch: master
branch: master
34 changes: 19 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
#!/bin/bash

# Ensure any exit code exits TravisCI
set -e
set -e

export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
DotnetCliVersion=${CLI_VERSION:="1.0.1"}
install_script_url=https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh
curl -sSL $install_script_url | bash /dev/stdin --version "$DotnetCliVersion" --install-dir "$DOTNET_INSTALL_DIR"
export PATH="$DOTNET_INSTALL_DIR:$PATH"

# See issue https://github.com/NuGet/Home/issues/2163
ulimit -n 2048

dotnet --info
dotnet restore
for path in src/*/project.json; do
dirname="$(dirname "${path}")"
dotnet build ${dirname}
done

for path in sample/project.json; do
dirname="$(dirname "${path}")"
dotnet build ${dirname}
done
for path in src/**/*.csproj; do
dotnet build -f netstandard1.1 -c Release ${path}
done

for path in test/*.Tests/*.csproj; do
dotnet test -f netcoreapp1.0 -c Release ${path}
done

for path in test/Serilog.Sinks.Splunk.Tests/project.json; do
dirname="$(dirname "${path}")"
dotnet build ${dirname} -f netcoreapp1.0 -c Release
dotnet test ${dirname} -f netcoreapp1.0 -c Release
done
dotnet build -f netcoreapp1.0 -c Release sample/Sample/Sample.csproj
6 changes: 0 additions & 6 deletions global.json

This file was deleted.

84 changes: 51 additions & 33 deletions sample/Program.cs → sample/Sample/Program.cs
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
using System.Linq;
using System.Threading;
using Serilog;
using Serilog.Core;
using Serilog.Sinks.Splunk;

namespace Sample
{
///
/// Sample 10 false
///
public class Program
{
public static string EventCollectorToken = "2B94855F-1184-46F7-BFF1-56A3112F627E";

public static void Main(string[] args)
{
var eventsToCreate = 100;
var runSSL = false;
if(args.Length > 0)
eventsToCreate = int.Parse(args[0]);
if(args.Length == 2)
runSSL = bool.Parse(args[1]);

if (args.Length > 0)
eventsToCreate = int.Parse(args[0]);

if (args.Length == 2)
runSSL = bool.Parse(args[1]);

Log.Information("Sample starting up");
Serilog.Debugging.SelfLog.Enable(System.Console.Out);
Expand All @@ -32,27 +28,49 @@ public static void Main(string[] args)
OverridingSourceType(eventsToCreate);
OverridingHost(eventsToCreate);
WithNoTemplate(eventsToCreate);

if(runSSL)
WithCompactSplunkFormatter(eventsToCreate);
if (runSSL)
UsingSSL(eventsToCreate);

Log.Debug("Done");
}

private static void WithCompactSplunkFormatter(int eventsToCreate)
{
// Vanilla Test with full uri specified
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088/services/collector",
Program.EventCollectorToken,new CompactSplunkJsonFormatter())
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla with CompactSplunkJsonFormatter specified")
.CreateLogger();


foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("{Counter}{Message}", i, "Running vanilla loop with CompactSplunkJsonFormatter");
}

Log.CloseAndFlush();
}

public static void OverridingSource(int eventsToCreate)
{
// Override Source
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088",
"http://localhost:8088",
Program.EventCollectorToken,
source: "Serilog.Sinks.Splunk.Sample.TestSource")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Source Override")
.CreateLogger();

foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("Running source override loop {Counter}", i);
Expand All @@ -67,15 +85,15 @@ public static void OverridingSourceType(int eventsToCreate)
// Override Source
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088",
"http://localhost:8088",
Program.EventCollectorToken,
sourceType: "Serilog.Sinks.Splunk.Sample.TestSourceType")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Source Type Override")
.CreateLogger();

foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("Running source type override loop {Counter}", i);
Expand All @@ -90,15 +108,15 @@ public static void OverridingHost(int eventsToCreate)
// Override Host
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088",
"http://localhost:8088",
Program.EventCollectorToken,
host: "myamazingmachine")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Host Override")
.CreateLogger();

foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("Running host override loop {Counter}", i);
Expand All @@ -113,7 +131,7 @@ public static void UsingFullUri(int eventsToCreate)
// Vanilla Test with full uri specified
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088/services/collector",
Program.EventCollectorToken)
Expand All @@ -135,13 +153,13 @@ public static void UsingHostOnly(int eventsToCreate)
// Vanilla Tests just host
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088",
Program.EventCollectorToken)
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla No services/collector in uri")
.CreateLogger();
.CreateLogger();

foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Expand All @@ -156,15 +174,15 @@ public static void WithNoTemplate(int eventsToCreate)
// No Template
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"http://localhost:8088",
"http://localhost:8088",
Program.EventCollectorToken,
renderTemplate: false)
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "No Templates")
.CreateLogger();

foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("Running no template loop {Counter}", i);
Expand All @@ -178,14 +196,14 @@ public static void UsingSSL(int eventsToCreate)
// SSL
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.LiterateConsole()
.WriteTo.LiterateConsole()
.WriteTo.EventCollector(
"https://localhost:8088",
Program.EventCollectorToken)
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
.Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "HTTPS")
.CreateLogger();
.CreateLogger();

foreach (var i in Enumerable.Range(0, eventsToCreate))
{
Log.Information("HTTPS {Counter}", i);
Expand Down
17 changes: 17 additions & 0 deletions sample/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.4.0" />
<PackageReference Include="Serilog.Sinks.Literate" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Sinks.Splunk\Serilog.Sinks.Splunk.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 0dc2fb5

Please sign in to comment.