Skip to content

Commit ba87389

Browse files
committed
Renames, build infrastructure
1 parent d36f39f commit ba87389

18 files changed

+391
-36
lines changed

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Auto detect text files and perform LF normalization
2+
3+
* text=auto

Build.ps1

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
param(
2+
[String] $majorMinor = "0.0", # 2.0
3+
[String] $patch = "0", # $env:APPVEYOR_BUILD_VERSION
4+
[String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
5+
[Switch] $notouch,
6+
[String] $sln # e.g serilog-sink-name
7+
)
8+
9+
function Set-AssemblyVersions($informational, $assembly)
10+
{
11+
(Get-Content assets/CommonAssemblyInfo.cs) |
12+
ForEach-Object { $_ -replace """1.0.0.0""", """$assembly""" } |
13+
ForEach-Object { $_ -replace """1.0.0""", """$informational""" } |
14+
ForEach-Object { $_ -replace """1.1.1.1""", """$($informational).0""" } |
15+
Set-Content assets/CommonAssemblyInfo.cs
16+
}
17+
18+
function Install-NuGetPackages($solution)
19+
{
20+
nuget restore $solution
21+
}
22+
23+
function Invoke-MSBuild($solution, $customLogger)
24+
{
25+
if ($customLogger)
26+
{
27+
msbuild "$solution" /verbosity:minimal /p:Configuration=Release /logger:"$customLogger"
28+
}
29+
else
30+
{
31+
msbuild "$solution" /verbosity:minimal /p:Configuration=Release
32+
}
33+
}
34+
35+
function Invoke-NuGetPackProj($csproj)
36+
{
37+
nuget pack -Prop Configuration=Release -Symbols $csproj
38+
}
39+
40+
function Invoke-NuGetPackSpec($nuspec, $version)
41+
{
42+
nuget pack $nuspec -Version $version -OutputDirectory ..\..\
43+
}
44+
45+
function Invoke-NuGetPack($version)
46+
{
47+
ls src/**/*.csproj |
48+
Where-Object { -not ($_.Name -like "*net40*") } |
49+
ForEach-Object { Invoke-NuGetPackProj $_ }
50+
}
51+
52+
function Invoke-Build($majorMinor, $patch, $customLogger, $notouch, $sln)
53+
{
54+
$package="$majorMinor.$patch"
55+
$slnfile = "$sln.sln"
56+
57+
Write-Output "$sln $package"
58+
59+
if (-not $notouch)
60+
{
61+
$assembly = "$majorMinor.0.0"
62+
63+
Write-Output "Assembly version will be set to $assembly"
64+
Set-AssemblyVersions $package $assembly
65+
}
66+
67+
Install-NuGetPackages $slnfile
68+
69+
Invoke-MSBuild $slnfile $customLogger
70+
71+
Invoke-NuGetPack $package
72+
}
73+
74+
$ErrorActionPreference = "Stop"
75+
76+
if (-not $sln)
77+
{
78+
$slnfull = ls *.sln |
79+
Where-Object { -not ($_.Name -like "*net40*") } |
80+
Select -first 1
81+
82+
$sln = $slnfull.BaseName
83+
}
84+
85+
Invoke-Build $majorMinor $patch $customLogger $notouch $sln

CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1.5
2+
* Moved from serilog/serilog
3+
4+
1.5.9
5+
* https://github.com/serilog/serilog-sinks-email/pull/2 - Enable use of network credentials from app.config SMTP configuration

Properties/AssemblyInfo.cs

-5
This file was deleted.

assets/CommonAssemblyInfo.cs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyVersion("1.0.0.0")]
4+
[assembly: AssemblyFileVersion("1.1.1.1")]
5+
[assembly: AssemblyInformationalVersion("1.0.0")]

assets/SerilogWeb.snk

596 Bytes
Binary file not shown.

serilog-web-owin.sln

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.31101.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerilogWeb.Owin", "src\SerilogWeb.Owin\SerilogWeb.Owin.csproj", "{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerilogWeb.Owin.Tests", "test\SerilogWeb.Owin.Tests\SerilogWeb.Owin.Tests.csproj", "{4F81EDAE-2E06-4024-925A-E495C852BDCF}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{4F81EDAE-2E06-4024-925A-E495C852BDCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{4F81EDAE-2E06-4024-925A-E495C852BDCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{4F81EDAE-2E06-4024-925A-E495C852BDCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{4F81EDAE-2E06-4024-925A-E495C852BDCF}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal

Extras/MSOwin/AppBuilderExtensions.cs src/SerilogWeb.Owin/Owin/AppBuilderExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
using Owin;
1616

17-
namespace Serilog.Extras.MSOwin
17+
namespace SerilogWeb.Owin
1818
{
1919
/// <summary>
2020
/// Extends <see cref="IAppBuilder"/> with support for installing Serilog middleware.

Extras/MSOwin/LoggerFactory.cs src/SerilogWeb.Owin/Owin/LoggerFactory.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Serilog Contributors
1+
// Copyright 2015 SerilogWeb, Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -15,10 +15,12 @@
1515
using System;
1616
using System.Diagnostics;
1717
using Microsoft.Owin.Logging;
18+
using Serilog;
1819
using Serilog.Core;
1920
using Serilog.Events;
21+
using ILogger = Serilog.ILogger;
2022

21-
namespace Serilog.Extras.MSOwin
23+
namespace SerilogWeb.Owin
2224
{
2325
/// <summary>
2426
/// Implementation of Microsoft.Owin.Logger.ILoggerFactory.

Extras/MSOwin/RequestContextMiddleware.cs src/SerilogWeb.Owin/Owin/RequestContextMiddleware.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Serilog Contributors
1+
// Copyright 2015 SerilogWeb, Serilog Contributors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
using System.Threading.Tasks;
1818
using Serilog.Context;
1919

20-
namespace Serilog.Extras.MSOwin
20+
namespace SerilogWeb.Owin
2121
{
2222
/// <summary>
2323
/// Adds a RequestId property to the logging context during request processing.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyTitle("SerilogWeb.Owin")]
4+
[assembly: AssemblyDescription("Middleware and logging support for OWIN using Serilog")]
5+
[assembly: AssemblyCopyright("Copyright © SerilogWeb Contributors, Serilog Contributors 2015")]

Serilog.Extras.MSOwin.csproj src/SerilogWeb.Owin/SerilogWeb.Owin.csproj

+17-21
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Serilog</RootNamespace>
11-
<AssemblyName>Serilog.Extras.MSOwin</AssemblyName>
10+
<RootNamespace>SerilogWeb</RootNamespace>
11+
<AssemblyName>SerilogWeb.Owin</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
@@ -21,7 +21,7 @@
2121
<DefineConstants>DEBUG;TRACE</DefineConstants>
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
24-
<DocumentationFile>bin\Debug\Serilog.Extras.MSOwin.XML</DocumentationFile>
24+
<DocumentationFile>bin\Debug\SerilogWeb.Owin.xml</DocumentationFile>
2525
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2626
</PropertyGroup>
2727
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -31,14 +31,14 @@
3131
<DefineConstants>TRACE</DefineConstants>
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>
34-
<DocumentationFile>bin\Release\Serilog.Extras.MSOwin.XML</DocumentationFile>
34+
<DocumentationFile>bin\Release\SerilogWeb.Owin.xml</DocumentationFile>
3535
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3636
</PropertyGroup>
3737
<PropertyGroup>
3838
<SignAssembly>true</SignAssembly>
3939
</PropertyGroup>
4040
<PropertyGroup>
41-
<AssemblyOriginatorKeyFile>..\..\assets\Serilog.snk</AssemblyOriginatorKeyFile>
41+
<AssemblyOriginatorKeyFile>..\..\assets\SerilogWeb.snk</AssemblyOriginatorKeyFile>
4242
</PropertyGroup>
4343
<ItemGroup>
4444
<Reference Include="Microsoft.Owin">
@@ -47,35 +47,31 @@
4747
<Reference Include="Owin">
4848
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
4949
</Reference>
50+
<Reference Include="Serilog">
51+
<HintPath>..\..\packages\Serilog.1.4.204\lib\net45\Serilog.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Serilog.FullNetFx">
54+
<HintPath>..\..\packages\Serilog.1.4.204\lib\net45\Serilog.FullNetFx.dll</HintPath>
55+
</Reference>
5056
<Reference Include="System" />
5157
<Reference Include="System.Core" />
5258
</ItemGroup>
5359
<ItemGroup>
54-
<Compile Include="Extras\MSOwin\AppBuilderExtensions.cs" />
55-
<Compile Include="Extras\MSOwin\LoggerFactory.cs" />
56-
<Compile Include="Extras\MSOwin\RequestContextMiddleware.cs" />
60+
<Compile Include="Owin\AppBuilderExtensions.cs" />
61+
<Compile Include="Owin\LoggerFactory.cs" />
62+
<Compile Include="Owin\RequestContextMiddleware.cs" />
5763
<Compile Include="Properties\AssemblyInfo.cs" />
5864
<Compile Include="..\..\assets\CommonAssemblyInfo.cs">
5965
<Link>Properties\CommonAssemblyInfo.cs</Link>
6066
</Compile>
6167
</ItemGroup>
6268
<ItemGroup />
6369
<ItemGroup>
64-
<None Include="..\..\assets\Serilog.snk">
65-
<Link>Serilog.snk</Link>
70+
<None Include="..\..\assets\SerilogWeb.snk">
71+
<Link>SerilogWeb.snk</Link>
6672
</None>
6773
<None Include="packages.config" />
68-
<None Include="Serilog.Extras.MSOwin.nuspec" />
69-
</ItemGroup>
70-
<ItemGroup>
71-
<ProjectReference Include="..\Serilog.FullNetFx\Serilog.FullNetFx.csproj">
72-
<Project>{7A9E1095-167D-402A-B43D-B36B97FF183D}</Project>
73-
<Name>Serilog.FullNetFx</Name>
74-
</ProjectReference>
75-
<ProjectReference Include="..\Serilog\Serilog.csproj">
76-
<Project>{0915dbd9-0f7c-4439-8d9e-74c3d579b219}</Project>
77-
<Name>Serilog</Name>
78-
</ProjectReference>
74+
<None Include="SerilogWeb.Owin.nuspec" />
7975
</ItemGroup>
8076
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
8177
</Project>

Serilog.Extras.MSOwin.nuspec src/SerilogWeb.Owin/SerilogWeb.Owin.nuspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
4-
<id>Serilog.Extras.MSOwin</id>
4+
<id>SerilogWeb.Owin</id>
55
<version>$version$</version>
6-
<authors>Serilog Contributors</authors>
6+
<authors>SerilogWeb Contributors, Serilog Contributors</authors>
77
<description>Provides request correlation middleware and integration with Microsoft.Owin logging.</description>
88
<language>en-US</language>
9-
<projectUrl>http://serilog.net</projectUrl>
9+
<projectUrl>http://github.com/serilog-web/owin</projectUrl>
1010
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
11-
<iconUrl>http://serilog.net/images/serilog-nuget.png</iconUrl>
11+
<iconUrl>http://serilog.net/images/serilog-web-nuget.png</iconUrl>
1212
<tags>serilog logging owin</tags>
1313
<dependencies>
14-
<dependency id="Serilog" version="$version$" />
14+
<dependency id="Serilog" version="1.4.204" />
1515
<dependency id="Owin" version="1.0" />
1616
<dependency id="Microsoft.Owin" version="2.1.0" />
1717
</dependencies>

packages.config src/SerilogWeb.Owin/packages.config

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<packages>
33
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
44
<package id="Owin" version="1.0" targetFramework="net45" />
5+
<package id="Serilog" version="1.4.204" targetFramework="net45" />
56
</packages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Reactive.Linq;
3+
using Microsoft.Owin.Logging;
4+
using NUnit.Framework;
5+
using Serilog.Events;
6+
using LoggerFactory = SerilogWeb.Owin.LoggerFactory;
7+
8+
namespace Serilog.Owin
9+
{
10+
[TestFixture]
11+
public class LoggerFactoryTests
12+
{
13+
[Test]
14+
public void CanCreateLogger()
15+
{
16+
var loggerFactory = new LoggerFactory();
17+
18+
var logger = loggerFactory.Create("LoggerFactoryTests");
19+
20+
Assert.NotNull(logger);
21+
}
22+
23+
[Test]
24+
public void EventsAreWritten()
25+
{
26+
var eventSeen = false;
27+
var log = new LoggerConfiguration()
28+
.WriteTo
29+
.Observers(events => events
30+
.Do(evt => { eventSeen = true; })
31+
.Subscribe())
32+
.CreateLogger();
33+
var loggerFactory = new LoggerFactory(log);
34+
35+
loggerFactory
36+
.Create("LoggerFactoryTests")
37+
.WriteError("error");
38+
39+
Assert.True(eventSeen);
40+
}
41+
42+
[Test]
43+
public void CanOverrideTraceEventToLogLevelConversion()
44+
{
45+
LogEvent eventSeen = null;
46+
var log = new LoggerConfiguration()
47+
.WriteTo
48+
.Observers(events => events
49+
.Do(evt => { eventSeen = evt; })
50+
.Subscribe())
51+
.CreateLogger();
52+
var loggerFactory = new LoggerFactory(log, traceEventType => LogEventLevel.Fatal);
53+
54+
loggerFactory
55+
.Create("LoggerFactoryTests")
56+
.WriteError("error");
57+
58+
Assert.AreEqual(eventSeen.Level, LogEventLevel.Fatal);
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)