From f33879627d6ce7ea34b3113abd8a09e936023cf4 Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Wed, 16 Mar 2016 16:24:12 +1000 Subject: [PATCH] Removed trace sink. --- Serilog.sln | 14 ----- .../Properties/AssemblyInfo.cs | 14 ----- .../Serilog.Sinks.Trace.xproj | 18 ------- .../Sinks/Trace/TraceSink.cs | 52 ------------------ .../TraceLoggerConfigurationExtensions.cs | 54 ------------------- src/Serilog.Sinks.Trace/project.json | 24 --------- test/Serilog.Tests/project.json | 1 - 7 files changed, 177 deletions(-) delete mode 100644 src/Serilog.Sinks.Trace/Properties/AssemblyInfo.cs delete mode 100644 src/Serilog.Sinks.Trace/Serilog.Sinks.Trace.xproj delete mode 100644 src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs delete mode 100644 src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs delete mode 100644 src/Serilog.Sinks.Trace/project.json diff --git a/Serilog.sln b/Serilog.sln index ccc1f441f..9cc99eceb 100644 --- a/Serilog.sln +++ b/Serilog.sln @@ -21,16 +21,12 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog", "src\Serilog\Seri EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Tests", "test\Serilog.Tests\Serilog.Tests.xproj", "{3C2D8E01-5580-426A-BDD9-EC59CD98E618}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.Console", "src\Serilog.Sinks.Console\Serilog.Sinks.Console.xproj", "{866A028E-27DB-49A0-AC78-E5FEF247C099}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.RollingFile", "src\Serilog.Sinks.RollingFile\Serilog.Sinks.RollingFile.xproj", "{A3E6E5B4-995F-4C3D-9673-A4B6000F4E21}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.PeriodicBatching", "src\Serilog.Sinks.PeriodicBatching\Serilog.Sinks.PeriodicBatching.xproj", "{324C2F52-D9F7-4844-9BC4-9906E228D380}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.Observable", "src\Serilog.Sinks.Observable\Serilog.Sinks.Observable.xproj", "{8D6C0BB9-D04D-49B6-9043-4A776AD275D5}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.ColoredConsole", "src\Serilog.Sinks.ColoredConsole\Serilog.Sinks.ColoredConsole.xproj", "{50B24ACA-D8F0-4268-A477-871B0A92A04A}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.File", "src\Serilog.Sinks.File\Serilog.Sinks.File.xproj", "{57E0ED0E-0F45-48AB-A73D-6A92B7C32095}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.TextWriter", "src\Serilog.Sinks.TextWriter\Serilog.Sinks.TextWriter.xproj", "{E85ABEC7-9B4C-432C-9A04-AC5BE9205D9F}" @@ -59,10 +55,6 @@ Global {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Debug|Any CPU.Build.0 = Debug|Any CPU {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Release|Any CPU.ActiveCfg = Release|Any CPU {3C2D8E01-5580-426A-BDD9-EC59CD98E618}.Release|Any CPU.Build.0 = Release|Any CPU - {866A028E-27DB-49A0-AC78-E5FEF247C099}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {866A028E-27DB-49A0-AC78-E5FEF247C099}.Debug|Any CPU.Build.0 = Debug|Any CPU - {866A028E-27DB-49A0-AC78-E5FEF247C099}.Release|Any CPU.ActiveCfg = Release|Any CPU - {866A028E-27DB-49A0-AC78-E5FEF247C099}.Release|Any CPU.Build.0 = Release|Any CPU {A3E6E5B4-995F-4C3D-9673-A4B6000F4E21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A3E6E5B4-995F-4C3D-9673-A4B6000F4E21}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3E6E5B4-995F-4C3D-9673-A4B6000F4E21}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -75,10 +67,6 @@ Global {8D6C0BB9-D04D-49B6-9043-4A776AD275D5}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D6C0BB9-D04D-49B6-9043-4A776AD275D5}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D6C0BB9-D04D-49B6-9043-4A776AD275D5}.Release|Any CPU.Build.0 = Release|Any CPU - {50B24ACA-D8F0-4268-A477-871B0A92A04A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50B24ACA-D8F0-4268-A477-871B0A92A04A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50B24ACA-D8F0-4268-A477-871B0A92A04A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50B24ACA-D8F0-4268-A477-871B0A92A04A}.Release|Any CPU.Build.0 = Release|Any CPU {57E0ED0E-0F45-48AB-A73D-6A92B7C32095}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {57E0ED0E-0F45-48AB-A73D-6A92B7C32095}.Debug|Any CPU.Build.0 = Debug|Any CPU {57E0ED0E-0F45-48AB-A73D-6A92B7C32095}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -114,11 +102,9 @@ Global GlobalSection(NestedProjects) = preSolution {803CD13A-D54B-4CEC-A55F-E22AE3D93B3C} = {037440DE-440B-4129-9F7A-09B42D00397E} {3C2D8E01-5580-426A-BDD9-EC59CD98E618} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0} - {866A028E-27DB-49A0-AC78-E5FEF247C099} = {037440DE-440B-4129-9F7A-09B42D00397E} {A3E6E5B4-995F-4C3D-9673-A4B6000F4E21} = {037440DE-440B-4129-9F7A-09B42D00397E} {324C2F52-D9F7-4844-9BC4-9906E228D380} = {037440DE-440B-4129-9F7A-09B42D00397E} {8D6C0BB9-D04D-49B6-9043-4A776AD275D5} = {037440DE-440B-4129-9F7A-09B42D00397E} - {50B24ACA-D8F0-4268-A477-871B0A92A04A} = {037440DE-440B-4129-9F7A-09B42D00397E} {57E0ED0E-0F45-48AB-A73D-6A92B7C32095} = {037440DE-440B-4129-9F7A-09B42D00397E} {E85ABEC7-9B4C-432C-9A04-AC5BE9205D9F} = {037440DE-440B-4129-9F7A-09B42D00397E} {8849C92D-2120-4C82-8226-22DF40195237} = {037440DE-440B-4129-9F7A-09B42D00397E} diff --git a/src/Serilog.Sinks.Trace/Properties/AssemblyInfo.cs b/src/Serilog.Sinks.Trace/Properties/AssemblyInfo.cs deleted file mode 100644 index 1237c0e24..000000000 --- a/src/Serilog.Sinks.Trace/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyVersion("2.0.0.0")] - -[assembly: CLSCompliant(true)] - -[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=" + - "0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" + - "6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" + - "d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" + - "94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" + - "b19485ec")] diff --git a/src/Serilog.Sinks.Trace/Serilog.Sinks.Trace.xproj b/src/Serilog.Sinks.Trace/Serilog.Sinks.Trace.xproj deleted file mode 100644 index cc8261c1e..000000000 --- a/src/Serilog.Sinks.Trace/Serilog.Sinks.Trace.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 8849c92d-2120-4c82-8226-22df40195237 - Serilog - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs b/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs deleted file mode 100644 index 9e85177db..000000000 --- a/src/Serilog.Sinks.Trace/Sinks/Trace/TraceSink.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2013-2016 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 System.IO; -using Serilog.Core; -using Serilog.Events; -using Serilog.Formatting; - -namespace Serilog.Sinks.DiagnosticTrace -{ - class TraceSink : ILogEventSink - { - readonly ITextFormatter _textFormatter; - - public TraceSink(ITextFormatter textFormatter) - { - if (textFormatter == null) throw new ArgumentNullException(nameof(textFormatter)); - _textFormatter = textFormatter; - } - - public void Emit(LogEvent logEvent) - { - if (logEvent == null) throw new ArgumentNullException(nameof(logEvent)); - var sr = new StringWriter(); - _textFormatter.Format(logEvent, sr); - - var text = sr.ToString().Trim(); - - if (logEvent.Level == LogEventLevel.Error || logEvent.Level == LogEventLevel.Fatal) - Trace.TraceError(text); - else if (logEvent.Level == LogEventLevel.Warning) - Trace.TraceWarning(text); - else if (logEvent.Level == LogEventLevel.Information) - Trace.TraceInformation(text); - else - Trace.WriteLine(text); - } - } -} diff --git a/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs b/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs deleted file mode 100644 index 75004b559..000000000 --- a/src/Serilog.Sinks.Trace/TraceLoggerConfigurationExtensions.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2013-2016 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 Serilog.Configuration; -using Serilog.Core; -using Serilog.Events; -using Serilog.Formatting.Display; -using Serilog.Sinks.DiagnosticTrace; - -namespace Serilog -{ - public static class TraceLoggerConfigurationExtensions - { - const string DefaultOutputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}"; - - /// - /// Write log events to the . - /// - /// Logger sink configuration. - /// The minimum level for - /// events passed through the sink. Ignored when is specified. - /// A switch allowing the pass-through minimum level - /// to be changed at runtime. - /// A message template describing the format used to write to the sink. - /// the default is "{Timestamp} [{Level}] {Message}{NewLine}{Exception}". - /// Supplies culture-specific formatting information, or null. - /// Configuration object allowing method chaining. - public static LoggerConfiguration Trace( - this LoggerSinkConfiguration sinkConfiguration, - LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, - string outputTemplate = DefaultOutputTemplate, - IFormatProvider formatProvider = null, - LoggingLevelSwitch levelSwitch = null) - { - if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration)); - if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate)); - var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider); - return sinkConfiguration.Sink(new TraceSink(formatter), restrictedToMinimumLevel, levelSwitch); - } - } -} \ No newline at end of file diff --git a/src/Serilog.Sinks.Trace/project.json b/src/Serilog.Sinks.Trace/project.json deleted file mode 100644 index b24a2a92a..000000000 --- a/src/Serilog.Sinks.Trace/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "2.0.0-beta-*", - "description": "The diagnostic trace sink for Serilog.", - "authors": [ "Serilog Contributors" ], - "tags": [ "serilog", "trace", "diagnostic" ], - "projectUrl": "http://serilog.net", - "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0", - "iconUrl": "http://serilog.net/images/serilog-sink-nuget.png", - "dependencies": { - "Serilog": { "target": "project" } - }, - "compilationOptions": { - "keyFile": "../../assets/Serilog.snk" - }, - "frameworks": { - "net45": { - }, - "dotnet5.1": { - "dependencies": { - "System.Diagnostics.TraceSource": "4.0.0-beta-23516" - } - } - } -} \ No newline at end of file diff --git a/test/Serilog.Tests/project.json b/test/Serilog.Tests/project.json index 54899f98c..99cb81e8f 100644 --- a/test/Serilog.Tests/project.json +++ b/test/Serilog.Tests/project.json @@ -11,7 +11,6 @@ "xunit": "2.1.0", "xunit.runner.visualstudio": "2.1.0", "xunit.runner.dnx": "2.1.0-rc1-build204", - "Serilog.Sinks.Trace": { "target": "project" }, "Serilog.Sinks.File": { "target": "project" }, "Serilog.Sinks.RollingFile": { "target": "project" }, "Serilog.Sinks.PeriodicBatching": { "target": "project" },