diff --git a/Serilog.sln b/Serilog.sln
index b866992a8..9242be609 100644
--- a/Serilog.sln
+++ b/Serilog.sln
@@ -24,14 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.FullNetFx", "src\Se
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.PerformanceTests", "test\Serilog.PerformanceTests\Serilog.PerformanceTests.csproj", "{6A6504BF-CD5B-4C9E-88EB-5BD71CE3106A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.Web", "src\Serilog.Extras.Web\Serilog.Extras.Web.csproj", "{13CEC8DD-6087-4FEE-AEC1-0511B8959CCD}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.AppSettings", "src\Serilog.Extras.AppSettings\Serilog.Extras.AppSettings.csproj", "{21CAF132-BBAB-41FD-A018-EB9AE54822ED}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.MSOwin", "src\Serilog.Extras.MSOwin\Serilog.Extras.MSOwin.csproj", "{FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.MSOwin.Tests", "test\Serilog.Extras.MSOwin.Tests\Serilog.Extras.MSOwin.Tests.csproj", "{4F81EDAE-2E06-4024-925A-E495C852BDCF}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.SmokeTest", "test\Serilog.SmokeTest\Serilog.SmokeTest.csproj", "{58563C46-B781-4799-ABD5-9745F94478FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.AppSettings.Tests", "test\Serilog.Extras.AppSettings.Tests\Serilog.Extras.AppSettings.Tests.csproj", "{67398D2A-0829-4373-ABC5-2161FEB28A05}"
@@ -60,22 +54,10 @@ Global
{6A6504BF-CD5B-4C9E-88EB-5BD71CE3106A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A6504BF-CD5B-4C9E-88EB-5BD71CE3106A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A6504BF-CD5B-4C9E-88EB-5BD71CE3106A}.Release|Any CPU.Build.0 = Release|Any CPU
- {13CEC8DD-6087-4FEE-AEC1-0511B8959CCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {13CEC8DD-6087-4FEE-AEC1-0511B8959CCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {13CEC8DD-6087-4FEE-AEC1-0511B8959CCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {13CEC8DD-6087-4FEE-AEC1-0511B8959CCD}.Release|Any CPU.Build.0 = Release|Any CPU
{21CAF132-BBAB-41FD-A018-EB9AE54822ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21CAF132-BBAB-41FD-A018-EB9AE54822ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21CAF132-BBAB-41FD-A018-EB9AE54822ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21CAF132-BBAB-41FD-A018-EB9AE54822ED}.Release|Any CPU.Build.0 = Release|Any CPU
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}.Release|Any CPU.Build.0 = Release|Any CPU
- {4F81EDAE-2E06-4024-925A-E495C852BDCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4F81EDAE-2E06-4024-925A-E495C852BDCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4F81EDAE-2E06-4024-925A-E495C852BDCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4F81EDAE-2E06-4024-925A-E495C852BDCF}.Release|Any CPU.Build.0 = Release|Any CPU
{58563C46-B781-4799-ABD5-9745F94478FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58563C46-B781-4799-ABD5-9745F94478FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58563C46-B781-4799-ABD5-9745F94478FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -97,10 +79,7 @@ Global
{D5648551-D19D-41E3-9FC1-E74B111EEF41} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
{7A9E1095-167D-402A-B43D-B36B97FF183D} = {037440DE-440B-4129-9F7A-09B42D00397E}
{6A6504BF-CD5B-4C9E-88EB-5BD71CE3106A} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
- {13CEC8DD-6087-4FEE-AEC1-0511B8959CCD} = {037440DE-440B-4129-9F7A-09B42D00397E}
{21CAF132-BBAB-41FD-A018-EB9AE54822ED} = {037440DE-440B-4129-9F7A-09B42D00397E}
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF} = {037440DE-440B-4129-9F7A-09B42D00397E}
- {4F81EDAE-2E06-4024-925A-E495C852BDCF} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
{58563C46-B781-4799-ABD5-9745F94478FD} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
{67398D2A-0829-4373-ABC5-2161FEB28A05} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
{7FC9FC46-5014-4461-A448-815E6CCE21E5} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0}
diff --git a/src/Serilog.Extras.MSOwin/Extras/MSOwin/AppBuilderExtensions.cs b/src/Serilog.Extras.MSOwin/Extras/MSOwin/AppBuilderExtensions.cs
deleted file mode 100644
index 5475228ff..000000000
--- a/src/Serilog.Extras.MSOwin/Extras/MSOwin/AppBuilderExtensions.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using Owin;
-
-namespace Serilog.Extras.MSOwin
-{
- ///
- /// Extends with support for installing Serilog middleware.
- ///
- public static class AppBuilderExtensions
- {
- ///
- /// Open a nested diagnostic context for each request allowing the correlation of log messages per request.
- ///
- /// The IAppBuilder passed to your configuration method
- /// The property name the request Id is associated with. Default is
- /// The original app parameter
- public static IAppBuilder UseSerilogRequestContext(this IAppBuilder app, string propertyName = RequestContextMiddleware.DefaultRequestIdPropertyName)
- {
- return app.Use(typeof(RequestContextMiddleware), new object[]{ propertyName });
- }
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.MSOwin/Extras/MSOwin/LoggerFactory.cs b/src/Serilog.Extras.MSOwin/Extras/MSOwin/LoggerFactory.cs
deleted file mode 100644
index c1e59ce11..000000000
--- a/src/Serilog.Extras.MSOwin/Extras/MSOwin/LoggerFactory.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Diagnostics;
-using Microsoft.Owin.Logging;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.MSOwin
-{
- ///
- /// Implementation of Microsoft.Owin.Logger.ILoggerFactory.
- ///
- public class LoggerFactory : ILoggerFactory
- {
- readonly Func _getLogger;
- readonly Func _getLogEventLevel;
-
- ///
- /// Create a logger factory.
- ///
- /// The logger; if not provided the global will be used.
- ///
- public LoggerFactory(ILogger logger = null, Func getLogEventLevel = null)
- {
- _getLogger = logger == null ? (Func) (() => Log.Logger) : (() => logger);
- _getLogEventLevel = getLogEventLevel ?? ToLogEventLevel;
- }
-
- ///
- /// Creates a new ILogger instance of the given name.
- ///
- /// The logger context name.
- /// A logger instance.
- public Microsoft.Owin.Logging.ILogger Create(string name)
- {
- return new Logger(_getLogger().ForContext(Constants.SourceContextPropertyName, name), _getLogEventLevel);
- }
-
- static LogEventLevel ToLogEventLevel(TraceEventType traceEventType)
- {
- switch (traceEventType)
- {
- case TraceEventType.Critical:
- return LogEventLevel.Fatal;
- case TraceEventType.Error:
- return LogEventLevel.Error;
- case TraceEventType.Warning:
- return LogEventLevel.Warning;
- case TraceEventType.Information:
- return LogEventLevel.Information;
- case TraceEventType.Verbose:
- return LogEventLevel.Verbose;
- case TraceEventType.Start:
- return LogEventLevel.Debug;
- case TraceEventType.Stop:
- return LogEventLevel.Debug;
- case TraceEventType.Suspend:
- return LogEventLevel.Debug;
- case TraceEventType.Resume:
- return LogEventLevel.Debug;
- case TraceEventType.Transfer:
- return LogEventLevel.Debug;
- default:
- throw new ArgumentOutOfRangeException("traceEventType");
- }
- }
-
- class Logger : Microsoft.Owin.Logging.ILogger
- {
- readonly ILogger _logger;
- readonly Func _getLogEventLevel;
-
- internal Logger(ILogger logger, Func getLogEventLevel)
- {
- _logger = logger;
- _getLogEventLevel = getLogEventLevel;
- }
-
- public bool WriteCore(TraceEventType eventType, int eventId, object state, Exception exception, Func formatter)
- {
- var level = _getLogEventLevel(eventType);
-
- // According to docs http://katanaproject.codeplex.com/SourceControl/latest#src/Microsoft.Owin/Logging/ILogger.cs
- // "To check IsEnabled call WriteCore with only TraceEventType and check the return value, no event will be written."
- if (state == null)
- {
- return _logger.IsEnabled(level);
- }
- if (!_logger.IsEnabled(level))
- {
- return false;
- }
- _logger.Write(level, exception, formatter(state, exception));
- return true;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.MSOwin/Extras/MSOwin/RequestContextMiddleware.cs b/src/Serilog.Extras.MSOwin/Extras/MSOwin/RequestContextMiddleware.cs
deleted file mode 100644
index e7bd79576..000000000
--- a/src/Serilog.Extras.MSOwin/Extras/MSOwin/RequestContextMiddleware.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Serilog.Context;
-
-namespace Serilog.Extras.MSOwin
-{
- ///
- /// Adds a RequestId property to the logging context during request processing.
- ///
- public class RequestContextMiddleware
- {
- ///
- /// The property name carrying the request ID.
- ///
- public const string DefaultRequestIdPropertyName = "RequestId";
-
- readonly Func, Task> _next;
- readonly string _propertyName;
-
- ///
- /// Construct the middleware.
- ///
- ///
- ///
- ///
- public RequestContextMiddleware(Func, Task> next, string propertyName = DefaultRequestIdPropertyName)
- {
- if (next == null)
- {
- throw new ArgumentNullException("next");
- }
- _next = next;
- _propertyName = string.IsNullOrWhiteSpace(propertyName) ? DefaultRequestIdPropertyName : propertyName;
- }
-
- ///
- /// Process a request.
- ///
- ///
- ///
- public async Task Invoke(IDictionary environment)
- {
- // There is not yet a standard way to uniquely identify and correlate an owin request
- // ... hence 'RequestId' https://github.com/owin/owin/issues/21
- using (LogContext.PushProperty(_propertyName, Guid.NewGuid()))
- {
- await _next(environment);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.MSOwin/Properties/AssemblyInfo.cs b/src/Serilog.Extras.MSOwin/Properties/AssemblyInfo.cs
deleted file mode 100644
index 0bd0ee657..000000000
--- a/src/Serilog.Extras.MSOwin/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-using System.Reflection;
-
-[assembly: AssemblyTitle("Serilog.Extras.MSOwin")]
-[assembly: AssemblyDescription("Middleware and logging support for OWIN using Serilog")]
-[assembly: AssemblyCopyright("Copyright © Serilog Contributors 2014")]
\ No newline at end of file
diff --git a/src/Serilog.Extras.MSOwin/Serilog.Extras.MSOwin.csproj b/src/Serilog.Extras.MSOwin/Serilog.Extras.MSOwin.csproj
deleted file mode 100644
index 406f0cf3c..000000000
--- a/src/Serilog.Extras.MSOwin/Serilog.Extras.MSOwin.csproj
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}
- Library
- Properties
- Serilog
- Serilog.Extras.MSOwin
- v4.5
- 512
- ..\..\
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- bin\Debug\Serilog.Extras.MSOwin.XML
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\Serilog.Extras.MSOwin.XML
- true
-
-
- true
-
-
- ..\..\assets\Serilog.snk
-
-
-
- ..\..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll
-
-
- ..\..\packages\Owin.1.0\lib\net40\Owin.dll
-
-
-
-
-
-
-
-
-
-
- Properties\CommonAssemblyInfo.cs
-
-
-
-
-
- Serilog.snk
-
-
-
-
-
-
- {7A9E1095-167D-402A-B43D-B36B97FF183D}
- Serilog.FullNetFx
-
-
- {0915dbd9-0f7c-4439-8d9e-74c3d579b219}
- Serilog
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Extras.MSOwin/Serilog.Extras.MSOwin.nuspec b/src/Serilog.Extras.MSOwin/Serilog.Extras.MSOwin.nuspec
deleted file mode 100644
index 1cc391c19..000000000
--- a/src/Serilog.Extras.MSOwin/Serilog.Extras.MSOwin.nuspec
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Serilog.Extras.MSOwin
- $version$
- Serilog Contributors
- Provides request correlation middleware and integration with Microsoft.Owin logging.
- en-US
- http://serilog.net
- http://www.apache.org/licenses/LICENSE-2.0
- http://serilog.net/images/serilog-nuget.png
- serilog logging owin
-
-
-
-
-
-
-
diff --git a/src/Serilog.Extras.MSOwin/packages.config b/src/Serilog.Extras.MSOwin/packages.config
deleted file mode 100644
index fb47f58ce..000000000
--- a/src/Serilog.Extras.MSOwin/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/ApplicationLifecycleModule.cs b/src/Serilog.Extras.Web/Extras/Web/ApplicationLifecycleModule.cs
deleted file mode 100644
index c0f911897..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/ApplicationLifecycleModule.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Linq;
-using System.Web;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web
-{
- ///
- /// HTTP module that logs application request and error events.
- ///
- public class ApplicationLifecycleModule : IHttpModule
- {
- static volatile bool _logPostedFormData;
- static volatile bool _isEnabled = true;
- static volatile LogEventLevel _requestLoggingLevel = LogEventLevel.Information;
-
- ///
- /// Register the module with the application (called automatically;
- /// do not call this explicitly from your code).
- ///
- public static void Register()
- {
- HttpApplication.RegisterModule(typeof(ApplicationLifecycleModule));
- }
-
- ///
- /// When set to true, form data will be written via a debug-level event.
- /// The default is false. Requires that is also
- /// true (which it is, by default).
- ///
- public static bool DebugLogPostedFormData
- {
- get { return _logPostedFormData; }
- set { _logPostedFormData = value; }
- }
-
- ///
- /// When set to true, request details and errors will be logged. The default
- /// is true.
- ///
- public static bool IsEnabled
- {
- get { return _isEnabled; }
- set { _isEnabled = value; }
- }
-
- ///
- /// The level at which to log HTTP requests. The default is Information.
- ///
- public static LogEventLevel RequestLoggingLevel
- {
- get { return _requestLoggingLevel; }
- set { _requestLoggingLevel = value; }
- }
-
- ///
- /// Initializes a module and prepares it to handle requests.
- ///
- /// An that provides access to the methods, properties, and events common to all application objects within an ASP.NET application
- public void Init(HttpApplication context)
- {
- context.LogRequest +=LogRequest;
- context.Error += Error;
- }
-
- static void LogRequest(object sender, EventArgs e)
- {
- if (!_isEnabled) return;
-
- var request = HttpContext.Current.Request;
- Log.Write(_requestLoggingLevel, "HTTP {Method} for {RawUrl}", request.HttpMethod, request.RawUrl);
- if (_logPostedFormData && Log.IsEnabled(LogEventLevel.Debug))
- {
- var form = request.Form;
- if (form.HasKeys())
- {
- var formData = form.AllKeys.SelectMany(k => (form.GetValues(k) ?? new string[0]).Select(v => new { Name = k, Value = v }));
- Log.Debug("Client provided {@FormData}", formData);
- }
- }
- }
-
- static void Error(object sender, EventArgs e)
- {
- if (!_isEnabled) return;
-
- var ex = ((HttpApplication)sender).Server.GetLastError();
- Log.Error(ex, "Error caught in global handler: {ExceptionMessage}", ex.Message);
- }
-
- ///
- /// Disposes of the resources (other than memory) used by the module that implements .
- ///
- public void Dispose()
- {
- }
- }
-}
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestClientHostIPEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestClientHostIPEnricher.cs
deleted file mode 100644
index c786a66da..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestClientHostIPEnricher.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Linq;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the Client IP Address.
- ///
- public class HttpRequestClientHostIPEnricher : ILogEventEnricher
- {
- ///
- /// Gets or sets a value indicating whether this enricher will check for possible HTTP proxies via X-FORWARDED-FOR headers.
- ///
- ///
- /// true if [check for HTTP proxies]; otherwise, false .
- ///
- public bool CheckForHttpProxies { get; set; }
-
- ///
- /// Initializes a new instance of the class with set to [true].
- ///
- public HttpRequestClientHostIPEnricher()
- {
- CheckForHttpProxies = true;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// if set to true this Enricher also checks for HTTP proxies and their X-FORWARDED-FOR header.
- public HttpRequestClientHostIPEnricher(bool checkForHttpProxies)
- {
- CheckForHttpProxies = checkForHttpProxies;
- }
-
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestClientHostIPPropertyName = "HttpRequestClientHostIP";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (string.IsNullOrWhiteSpace(HttpContext.Current.Request.UserHostAddress))
- return;
-
- string userHostAddress;
-
- // Taking Proxy/-ies into consideration, too (if wanted and available)
- if (CheckForHttpProxies)
- {
- userHostAddress = !string.IsNullOrWhiteSpace(HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"])
- ? HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]
- : HttpContext.Current.Request.UserHostAddress;
- }
- else
- {
- userHostAddress = HttpContext.Current.Request.UserHostAddress;
- }
-
- if (string.IsNullOrWhiteSpace(userHostAddress))
- return;
-
- // As multiple proxies can be in place according to header spec (see http://en.wikipedia.org/wiki/X-Forwarded-For), we check for it and only extract the first address (which 'should' be the actual client one)
- if (userHostAddress.Contains(","))
- {
- userHostAddress = userHostAddress.Split(',').First().Trim();
- }
-
- var httpRequestClientHostIPProperty = new LogEventProperty(HttpRequestClientHostIPPropertyName, new ScalarValue(userHostAddress));
- logEvent.AddPropertyIfAbsent(httpRequestClientHostIPProperty);
- }
-
- #endregion
- }
-}
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestClientHostNameEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestClientHostNameEnricher.cs
deleted file mode 100644
index e5b6a9f1c..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestClientHostNameEnricher.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the Client Host Name.
- ///
- public class HttpRequestClientHostNameEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestClientHostNamePropertyName = "HttpRequestClientHostName";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (string.IsNullOrWhiteSpace(HttpContext.Current.Request.UserHostName))
- return;
-
- var userHostName = HttpContext.Current.Request.UserHostName;
- var httpRequestClientHostnameProperty = new LogEventProperty(HttpRequestClientHostNamePropertyName, new ScalarValue(userHostName));
- logEvent.AddPropertyIfAbsent(httpRequestClientHostnameProperty);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestIdEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestIdEnricher.cs
deleted file mode 100644
index 08507743e..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestIdEnricher.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with a HttpRequestId GUID.
- ///
- public class HttpRequestIdEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestIdPropertyName = "HttpRequestId";
-
- static readonly string RequestIdItemName = typeof(HttpRequestIdEnricher).Name + "+RequestId";
-
- ///
- /// Enrich the log event with an id assigned to the currently-executing HTTP request, if any.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- Guid requestId;
- var requestIdItem = HttpContext.Current.Items[RequestIdItemName];
- if (requestIdItem == null)
- HttpContext.Current.Items[RequestIdItemName] = requestId = Guid.NewGuid();
- else
- requestId = (Guid)requestIdItem;
-
- var requestIdProperty = new LogEventProperty(HttpRequestIdPropertyName, new ScalarValue(requestId));
- logEvent.AddPropertyIfAbsent(requestIdProperty);
- }
- }
-}
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestNumberEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestNumberEnricher.cs
deleted file mode 100644
index 85493fbde..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestNumberEnricher.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Threading;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with a HttpRequestNumber unique within the current
- /// logging session.
- ///
- public class HttpRequestNumberEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestNumberPropertyName = "HttpRequestNumber";
-
- static int LastRequestNumber;
- static readonly string RequestNumberItemName = typeof(HttpRequestNumberEnricher).Name + "+RequestNumber";
-
- ///
- /// Enrich the log event with the number assigned to the currently-executing HTTP request, if any.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- int requestNumber;
- var requestNumberItem = HttpContext.Current.Items[RequestNumberItemName];
- if (requestNumberItem == null)
- HttpContext.Current.Items[RequestNumberItemName] = requestNumber = Interlocked.Increment(ref LastRequestNumber);
- else
- requestNumber = (int)requestNumberItem;
-
- var requestNumberProperty = new LogEventProperty(HttpRequestNumberPropertyName, new ScalarValue(requestNumber));
- logEvent.AddPropertyIfAbsent(requestNumberProperty);
- }
- }
-}
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestRawUrlEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestRawUrlEnricher.cs
deleted file mode 100644
index dfcab55cc..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestRawUrlEnricher.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the Raw Url of the Request.
- ///
- public class HttpRequestRawUrlEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestRawUrlPropertyName = "HttpRequestRawUrl";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (string.IsNullOrWhiteSpace(HttpContext.Current.Request.RawUrl))
- return;
-
- var requestRawUrl = HttpContext.Current.Request.RawUrl;
- var httpRequestRawUrlProperty = new LogEventProperty(HttpRequestRawUrlPropertyName, new ScalarValue(requestRawUrl));
- logEvent.AddPropertyIfAbsent(httpRequestRawUrlProperty);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestTraceIdEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestTraceIdEnricher.cs
deleted file mode 100644
index f40cdc19d..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestTraceIdEnricher.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with a HttpRequestTraceId GUID matching the
- /// RequestTraceIdentifier assigned by IIS and used throughout
- /// ASP.NET/ETW. IIS ETW tracing must be enabled for this to work.
- ///
- public class HttpRequestTraceIdEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestTraceIdPropertyName = "HttpRequestTraceId";
-
- ///
- /// Enrich the log event with an id assigned to the currently-executing HTTP request, if any.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- var serviceProvider = (IServiceProvider)HttpContext.Current;
- var workerRequest = (HttpWorkerRequest)serviceProvider.GetService(typeof(HttpWorkerRequest));
- var requestId = workerRequest.RequestTraceIdentifier;
-
- var requestIdProperty = new LogEventProperty(HttpRequestTraceIdPropertyName, new ScalarValue(requestId));
- logEvent.AddPropertyIfAbsent(requestIdProperty);
- }
- }
-}
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestTypeEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestTypeEnricher.cs
deleted file mode 100644
index ea8beb9de..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestTypeEnricher.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the HTTP Request Type.
- ///
- public class HttpRequestTypeEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestTypePropertyName = "HttpRequestType";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (string.IsNullOrWhiteSpace(HttpContext.Current.Request.RequestType))
- return;
-
- var requestType = HttpContext.Current.Request.RequestType;
- var httpRequestTypeProperty = new LogEventProperty(HttpRequestTypePropertyName, new ScalarValue(requestType));
- logEvent.AddPropertyIfAbsent(httpRequestTypeProperty);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUrlEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUrlEnricher.cs
deleted file mode 100644
index 50f3b1044..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUrlEnricher.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the Url of the Request.
- /// For the full, raw Url .
- ///
- public class HttpRequestUrlEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestUrlPropertyName = "HttpRequestUrl";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (HttpContext.Current.Request.Url == null)
- return;
-
- var requestUrl = HttpContext.Current.Request.Url.ToString();
- var httpRequestUrlProperty = new LogEventProperty(HttpRequestUrlPropertyName, new ScalarValue(requestUrl));
- logEvent.AddPropertyIfAbsent(httpRequestUrlProperty);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUrlReferrerEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUrlReferrerEnricher.cs
deleted file mode 100644
index 0c1759238..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUrlReferrerEnricher.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the Url of the Referrer.
- ///
- public class HttpRequestUrlReferrerEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestUrlReferrerPropertyName = "HttpRequestUrlReferrer";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (HttpContext.Current.Request.UrlReferrer == null)
- return;
-
- var requestUrlReferrer = HttpContext.Current.Request.UrlReferrer.ToString();
- var httpRequestUrlReferrerProperty = new LogEventProperty(HttpRequestUrlReferrerPropertyName, new ScalarValue(requestUrlReferrer));
- logEvent.AddPropertyIfAbsent(httpRequestUrlReferrerProperty);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUserAgentEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUserAgentEnricher.cs
deleted file mode 100644
index fc523bcba..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpRequestUserAgentEnricher.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the Client User Agent.
- ///
- public class HttpRequestUserAgentEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpRequestUserAgentPropertyName = "HttpRequestUserAgent";
-
- #region Implementation of ILogEventEnricher
-
- ///
- /// Enrich the log event.
- ///
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Request == null)
- return;
-
- if (string.IsNullOrWhiteSpace(HttpContext.Current.Request.UserAgent))
- return;
-
- var userAgent = HttpContext.Current.Request.UserAgent;
- var httpRequestUserAgentProperty = new LogEventProperty(HttpRequestUserAgentPropertyName, new ScalarValue(userAgent));
- logEvent.AddPropertyIfAbsent(httpRequestUserAgentProperty);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpSessionIdEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpSessionIdEnricher.cs
deleted file mode 100644
index bec91ac32..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/HttpSessionIdEnricher.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 Serilog Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the HttpSessionId property.
- ///
- public class HttpSessionIdEnricher : ILogEventEnricher
- {
- ///
- /// The property name added to enriched log events.
- ///
- public const string HttpSessionIdPropertyName = "HttpSessionId";
-
- ///
- /// Enrich the log event with the current ASP.NET session id, if sessions are enabled.
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null) throw new ArgumentNullException("logEvent");
-
- if (HttpContext.Current == null)
- return;
-
- if (HttpContext.Current.Session == null)
- return;
-
- var sessionId = HttpContext.Current.Session.SessionID;
- var sessionIdProperty = new LogEventProperty(HttpSessionIdPropertyName, new ScalarValue(sessionId));
- logEvent.AddPropertyIfAbsent(sessionIdProperty);
- }
- }
-}
diff --git a/src/Serilog.Extras.Web/Extras/Web/Enrichers/UserNameEnricher.cs b/src/Serilog.Extras.Web/Extras/Web/Enrichers/UserNameEnricher.cs
deleted file mode 100644
index 3cfac278c..000000000
--- a/src/Serilog.Extras.Web/Extras/Web/Enrichers/UserNameEnricher.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Web;
-using Serilog.Core;
-using Serilog.Events;
-
-namespace Serilog.Extras.Web.Enrichers
-{
- ///
- /// Enrich log events with the UserName property when available in the HttpContext.
- ///
- public class UserNameEnricher : ILogEventEnricher
- {
- readonly string _anonymousUsername;
- readonly string _noneUsername;
-
- ///
- /// The property name added to enriched log events.
- ///
- public const string UserNamePropertyName = "UserName";
-
- ///
- /// Initializes a new instance of the class.
- ///
- public UserNameEnricher()
- : this("(anonymous)", null)
- {
-
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The anonymous username. Leave null if you do not want to use anonymous user names. By default it is (anonymous).
- /// The none username. If there is no username to be found, it will output this username. Leave null (default) to ignore non usernames.
- public UserNameEnricher(string anonymousUsername = "(anonymous)", string noneUsername = null)
- {
- _anonymousUsername = anonymousUsername;
- _noneUsername = noneUsername;
- }
-
- ///
- /// Enrich the log event with the current ASP.NET user name, if User.Identity.IsAuthenticated is true.
- /// The log event to enrich.
- /// Factory for creating new properties to add to the event.
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
- {
- if (logEvent == null)
- throw new ArgumentNullException("logEvent");
-
- var userName = _noneUsername;
-
- if (HttpContext.Current != null)
- {
- var context = new HttpContextWrapper(HttpContext.Current);
-
- if (context.User != null)
- {
- if (context.User.Identity == null || context.User.Identity.IsAuthenticated == false)
- {
- if (_anonymousUsername != null)
- userName = _anonymousUsername;
- }
- else
- {
- userName = context.User.Identity.Name;
- }
- }
- }
-
- if (userName == null)
- return;
-
- var userNameProperty = new LogEventProperty(UserNamePropertyName, new ScalarValue(userName));
- logEvent.AddPropertyIfAbsent(userNameProperty);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Properties/AssemblyInfo.cs b/src/Serilog.Extras.Web/Properties/AssemblyInfo.cs
deleted file mode 100644
index b692b2774..000000000
--- a/src/Serilog.Extras.Web/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Reflection;
-using System.Web;
-using Serilog.Extras.Web;
-
-[assembly: AssemblyTitle("Serilog.Web")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyCopyright("Copyright © Serilog Contributors 2013")]
-
-[assembly: PreApplicationStartMethod(typeof(ApplicationLifecycleModule), "Register")]
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Serilog.Extras.Web.csproj b/src/Serilog.Extras.Web/Serilog.Extras.Web.csproj
deleted file mode 100644
index 8add7f3e0..000000000
--- a/src/Serilog.Extras.Web/Serilog.Extras.Web.csproj
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {13CEC8DD-6087-4FEE-AEC1-0511B8959CCD}
- Library
- Properties
- Serilog
- Serilog.Extras.Web
- v4.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
- bin\Debug\Serilog.Extras.Web.xml
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- true
- bin\Release\Serilog.Extras.Web.xml
-
-
- true
-
-
- ..\..\assets\Serilog.snk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Properties\CommonAssemblyInfo.cs
-
-
-
-
-
-
-
-
-
- Serilog.snk
-
-
- Designer
-
-
-
-
- {0915dbd9-0f7c-4439-8d9e-74c3d579b219}
- Serilog
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Extras.Web/Serilog.Extras.Web.nuspec b/src/Serilog.Extras.Web/Serilog.Extras.Web.nuspec
deleted file mode 100644
index cd87ddde8..000000000
--- a/src/Serilog.Extras.Web/Serilog.Extras.Web.nuspec
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- Serilog.Extras.Web
- $version$
- Serilog Contributors
- An event enricher for Serilog that adds details of the executing ASP.NET HTTP request. Replaces the deprecated Serilog.Web package.
- en-US
- http://serilog.net
- http://www.apache.org/licenses/LICENSE-2.0
- http://serilog.net/images/serilog-nuget.png
- serilog logging aspnet
-
-
-
-
-
diff --git a/test/Serilog.Extras.MSOwin.Tests/Extras/MSOwin/LoggerFactoryTests.cs b/test/Serilog.Extras.MSOwin.Tests/Extras/MSOwin/LoggerFactoryTests.cs
deleted file mode 100644
index 6367e821c..000000000
--- a/test/Serilog.Extras.MSOwin.Tests/Extras/MSOwin/LoggerFactoryTests.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-using System.Reactive.Linq;
-using Microsoft.Owin.Logging;
-using NUnit.Framework;
-using Serilog.Events;
-
-namespace Serilog.Extras.MSOwin
-{
- [TestFixture]
- public class LoggerFactoryTests
- {
- [Test]
- public void CanCreateLogger()
- {
- var loggerFactory = new LoggerFactory();
-
- var logger = loggerFactory.Create("LoggerFactoryTests");
-
- Assert.NotNull(logger);
- }
-
- [Test]
- public void EventsAreWritten()
- {
- var eventSeen = false;
- var log = new LoggerConfiguration()
- .WriteTo
- .Observers(events => events
- .Do(evt => { eventSeen = true; })
- .Subscribe())
- .CreateLogger();
- var loggerFactory = new LoggerFactory(log);
-
- loggerFactory
- .Create("LoggerFactoryTests")
- .WriteError("error");
-
- Assert.True(eventSeen);
- }
-
- [Test]
- public void CanOverrideTraceEventToLogLevelConversion()
- {
- LogEvent eventSeen = null;
- var log = new LoggerConfiguration()
- .WriteTo
- .Observers(events => events
- .Do(evt => { eventSeen = evt; })
- .Subscribe())
- .CreateLogger();
- var loggerFactory = new LoggerFactory(log, traceEventType => LogEventLevel.Fatal);
-
- loggerFactory
- .Create("LoggerFactoryTests")
- .WriteError("error");
-
- Assert.AreEqual(eventSeen.Level, LogEventLevel.Fatal);
- }
- }
-}
\ No newline at end of file
diff --git a/test/Serilog.Extras.MSOwin.Tests/Extras/MSOwin/RequestContextMiddlewareTests.cs b/test/Serilog.Extras.MSOwin.Tests/Extras/MSOwin/RequestContextMiddlewareTests.cs
deleted file mode 100644
index 58438b041..000000000
--- a/test/Serilog.Extras.MSOwin.Tests/Extras/MSOwin/RequestContextMiddlewareTests.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Reactive.Linq;
-using System.Threading.Tasks;
-using Owin;
-using Microsoft.Owin.Testing;
-using NUnit.Framework;
-using Serilog.Events;
-
-namespace Serilog.Extras.MSOwin
-{
- public class SerilogMiddlewareTests
- {
- [TestFixture]
- public class WhenUsingARequestContext
- {
- LogEvent _eventSeen;
- readonly TestServer _server;
-
- public WhenUsingARequestContext()
- {
- var logger = new LoggerConfiguration()
- .WriteTo
- .Observers(events => events
- .Do(evt => { _eventSeen = evt; })
- .Subscribe())
- .Enrich
- .FromLogContext()
- .CreateLogger();
- Log.Logger = logger;
-
- _server = TestServer.Create(
- app => app.UseSerilogRequestContext()
- .Use((context, func) =>
- {
- Log.Information("message");
- return Task.Delay(0);
- }));
- }
-
- [Test]
- public async Task Should_have_request_id_in_logevent_properties()
- {
- await MakeRequest();
-
- Assert.True(_eventSeen.Properties.ContainsKey(RequestContextMiddleware.DefaultRequestIdPropertyName));
- }
-
- [Test]
- public async Task Request_id_should_be_a_guid()
- {
- await MakeRequest();
-
- Guid _;
- Assert.True(Guid.TryParse(_eventSeen.Properties[RequestContextMiddleware.DefaultRequestIdPropertyName].ToString(), out _));
- }
-
- async Task MakeRequest()
- {
- await _server.CreateRequest("/").GetAsync();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/test/Serilog.Extras.MSOwin.Tests/Serilog.Extras.MSOwin.Tests.csproj b/test/Serilog.Extras.MSOwin.Tests/Serilog.Extras.MSOwin.Tests.csproj
deleted file mode 100644
index d7bf79193..000000000
--- a/test/Serilog.Extras.MSOwin.Tests/Serilog.Extras.MSOwin.Tests.csproj
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {4F81EDAE-2E06-4024-925A-E495C852BDCF}
- Library
- Properties
- Serilog
- Serilog.Extras.MSOwin.Tests
- v4.5
- 512
- ..\..\
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll
-
-
- ..\..\packages\Microsoft.Owin.Hosting.2.1.0\lib\net45\Microsoft.Owin.Hosting.dll
-
-
- ..\..\packages\Microsoft.Owin.Testing.2.1.0\lib\net45\Microsoft.Owin.Testing.dll
-
-
- ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll
-
-
- ..\..\packages\Owin.1.0\lib\net40\Owin.dll
-
-
-
-
-
- ..\..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll
-
-
- False
- ..\..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll
-
-
- ..\..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll
-
-
- ..\..\packages\Rx-PlatformServices.2.2.3\lib\net45\System.Reactive.PlatformServices.dll
-
-
-
-
-
-
-
-
-
-
-
- {FDCEBC10-F403-4DDD-8594-DE6D7DD543AF}
- Serilog.Extras.MSOwin
-
-
- {7a9e1095-167d-402a-b43d-b36b97ff183d}
- Serilog.FullNetFx
-
-
- {0915dbd9-0f7c-4439-8d9e-74c3d579b219}
- Serilog
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/Serilog.Extras.MSOwin.Tests/packages.config b/test/Serilog.Extras.MSOwin.Tests/packages.config
deleted file mode 100644
index 6c559526c..000000000
--- a/test/Serilog.Extras.MSOwin.Tests/packages.config
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file