diff --git a/Avalonia.sln b/Avalonia.sln index e8d5034fb0..5bff2fa0a0 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -95,8 +95,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.UnitTests", "tests EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Benchmarks", "tests\Avalonia.Benchmarks\Avalonia.Benchmarks.csproj", "{410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Logging.Serilog", "src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj", "{B61B66A3-B82D-4875-8001-89D3394FE0C9}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DesignerSupport", "src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj", "{799A7BB5-3C2C-48B6-85A7-406A12C420DA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog", "samples\ControlCatalog\ControlCatalog.csproj", "{D0A739B9-3C68-4BA6-A328-41606954B6BD}" @@ -140,7 +138,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Props", "Props", "{F3AC8BC1 build\ReactiveUI.props = build\ReactiveUI.props build\Rx.props = build\Rx.props build\SampleApp.props = build\SampleApp.props - build\Serilog.props = build\Serilog.props build\SharpDX.props = build\SharpDX.props build\SkiaSharp.props = build\SkiaSharp.props build\System.Memory.props = build\System.Memory.props @@ -1027,30 +1024,6 @@ Global {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhone.Build.0 = Release|Any CPU {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.AppStore|Any CPU.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.AppStore|iPhone.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Debug|iPhone.Build.0 = Debug|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Release|Any CPU.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Release|iPhone.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Release|iPhone.Build.0 = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B61B66A3-B82D-4875-8001-89D3394FE0C9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU diff --git a/build/CoreLibraries.props b/build/CoreLibraries.props index 2b54ee3f56..d17eec0135 100644 --- a/build/CoreLibraries.props +++ b/build/CoreLibraries.props @@ -7,7 +7,6 @@ - diff --git a/build/Serilog.props b/build/Serilog.props deleted file mode 100644 index a814cf998d..0000000000 --- a/build/Serilog.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/build/readme.md b/build/readme.md index 387afb3425..e147556b1c 100644 --- a/build/readme.md +++ b/build/readme.md @@ -9,8 +9,6 @@ - - @@ -22,4 +20,4 @@ ```XML -``` \ No newline at end of file +``` diff --git a/samples/BindingDemo/App.xaml.cs b/samples/BindingDemo/App.xaml.cs index f2f44cd502..13875aeb21 100644 --- a/samples/BindingDemo/App.xaml.cs +++ b/samples/BindingDemo/App.xaml.cs @@ -1,10 +1,8 @@ using System; using Avalonia; using Avalonia.Controls; -using Avalonia.Logging.Serilog; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; -using Serilog; namespace BindingDemo { diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj index ce33f42143..817023fd71 100644 --- a/samples/BindingDemo/BindingDemo.csproj +++ b/samples/BindingDemo/BindingDemo.csproj @@ -10,7 +10,6 @@ - diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj index 054de2a05f..1a112d0d7d 100644 --- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj +++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj @@ -10,6 +10,5 @@ - diff --git a/samples/ControlCatalog.Desktop/Program.cs b/samples/ControlCatalog.Desktop/Program.cs index 2a8d288614..b2df1953f5 100644 --- a/samples/ControlCatalog.Desktop/Program.cs +++ b/samples/ControlCatalog.Desktop/Program.cs @@ -2,10 +2,8 @@ using System; using System.Linq; using Avalonia; using Avalonia.Controls; -using Avalonia.Logging.Serilog; using Avalonia.Platform; using Avalonia.ReactiveUI; -using Serilog; namespace ControlCatalog { diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index 34a6e33677..8a88b89b48 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -28,6 +28,5 @@ - diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj index 0d7d62e177..d1654f4b54 100644 --- a/samples/RenderDemo/RenderDemo.csproj +++ b/samples/RenderDemo/RenderDemo.csproj @@ -13,7 +13,6 @@ - diff --git a/samples/VirtualizationDemo/Program.cs b/samples/VirtualizationDemo/Program.cs index 6304730aa0..93ea5e1b88 100644 --- a/samples/VirtualizationDemo/Program.cs +++ b/samples/VirtualizationDemo/Program.cs @@ -2,7 +2,6 @@ using Avalonia; using Avalonia.Controls; using Avalonia.ReactiveUI; -using Serilog; namespace VirtualizationDemo { diff --git a/samples/VirtualizationDemo/VirtualizationDemo.csproj b/samples/VirtualizationDemo/VirtualizationDemo.csproj index ce33f42143..817023fd71 100644 --- a/samples/VirtualizationDemo/VirtualizationDemo.csproj +++ b/samples/VirtualizationDemo/VirtualizationDemo.csproj @@ -10,7 +10,6 @@ - diff --git a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj index 3e318278c1..bd6b6f170f 100644 --- a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj +++ b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj @@ -26,7 +26,6 @@ - diff --git a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj index 2f95a6e4bd..b8697e0ca2 100644 --- a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj +++ b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj @@ -149,7 +149,6 @@ - diff --git a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj deleted file mode 100644 index 3e76001556..0000000000 --- a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - netstandard2.0 - - - - - - - diff --git a/src/Avalonia.Logging.Serilog/SerilogExtensions.cs b/src/Avalonia.Logging.Serilog/SerilogExtensions.cs deleted file mode 100644 index 2ce38769da..0000000000 --- a/src/Avalonia.Logging.Serilog/SerilogExtensions.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using Avalonia.Controls; -using Serilog; -using Serilog.Configuration; -using Serilog.Filters; -using SerilogLevel = Serilog.Events.LogEventLevel; - -namespace Avalonia.Logging.Serilog -{ - /// - /// Extension methods for Serilog logging. - /// - public static class SerilogExtensions - { - private const string DefaultTemplate = "[{Area}] {Message} ({SourceType} #{SourceHash})"; - - /// - /// Logs Avalonia events to the sink. - /// - /// The application class type. - /// The app builder instance. - /// The minimum level to log. - /// The app builder instance. - public static T LogToDebug( - this T builder, - LogEventLevel level = LogEventLevel.Warning) - where T : AppBuilderBase, new() - { - SerilogLogger.Initialize(new LoggerConfiguration() - .MinimumLevel.Is((SerilogLevel)level) - .Enrich.FromLogContext() - .WriteTo.Debug(outputTemplate: DefaultTemplate) - .CreateLogger()); - return builder; - } - - /// - /// Logs Avalonia events to the sink. - /// - /// The application class type. - /// The app builder instance. - /// The area to log. Valid values are listed in . - /// The minimum level to log. - /// The app builder instance. - public static T LogToDebug( - this T builder, - string area, - LogEventLevel level = LogEventLevel.Warning) - where T : AppBuilderBase, new() - { - SerilogLogger.Initialize(new LoggerConfiguration() - .MinimumLevel.Is((SerilogLevel)level) - .Filter.ByIncludingOnly(Matching.WithProperty("Area", area)) - .Enrich.FromLogContext() - .WriteTo.Debug(outputTemplate: DefaultTemplate) - .CreateLogger()); - return builder; - } - - /// - /// Logs Avalonia events to the sink. - /// - /// The application class type. - /// The app builder instance. - /// The minimum level to log. - /// The app builder instance. - public static T LogToTrace( - this T builder, - LogEventLevel level = LogEventLevel.Warning) - where T : AppBuilderBase, new() - { - SerilogLogger.Initialize(new LoggerConfiguration() - .MinimumLevel.Is((SerilogLevel)level) - .Enrich.FromLogContext() - .WriteTo.Trace(outputTemplate: DefaultTemplate) - .CreateLogger()); - return builder; - } - - /// - /// Logs Avalonia events to the sink. - /// - /// The application class type. - /// The app builder instance. - /// The area to log. Valid values are listed in . - /// The minimum level to log. - /// The app builder instance. - public static T LogToTrace( - this T builder, - string area, - LogEventLevel level = LogEventLevel.Warning) - where T : AppBuilderBase, new() - { - SerilogLogger.Initialize(new LoggerConfiguration() - .MinimumLevel.Is((SerilogLevel)level) - .Filter.ByIncludingOnly(Matching.WithProperty("Area", area)) - .Enrich.FromLogContext() - .WriteTo.Trace(outputTemplate: DefaultTemplate) - .CreateLogger()); - return builder; - } - } -} diff --git a/src/Avalonia.Logging.Serilog/SerilogLogger.cs b/src/Avalonia.Logging.Serilog/SerilogLogger.cs deleted file mode 100644 index 0433516b81..0000000000 --- a/src/Avalonia.Logging.Serilog/SerilogLogger.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using Serilog; -using Serilog.Context; -using AvaloniaLogEventLevel = Avalonia.Logging.LogEventLevel; -using SerilogLogEventLevel = Serilog.Events.LogEventLevel; - -namespace Avalonia.Logging.Serilog -{ - /// - /// Sends log output to serilog. - /// - public class SerilogLogger : ILogSink - { - private readonly ILogger _output; - - /// - /// Initializes a new instance of the class. - /// - /// The serilog logger to use. - public SerilogLogger(ILogger output) - { - _output = output; - } - - /// - /// Initializes the Avalonia logging with a new instance of a . - /// - /// The serilog logger to use. - public static void Initialize(ILogger output) - { - Logger.Sink = new SerilogLogger(output); - } - - public bool IsEnabled(LogEventLevel level, string area) - { - return _output.IsEnabled((SerilogLogEventLevel)level); - } - - public void Log( - LogEventLevel level, - string area, - object source, - string messageTemplate) - { - Contract.Requires(area != null); - Contract.Requires(messageTemplate != null); - - using (PushLogContextProperties(area, source)) - { - _output.Write((SerilogLogEventLevel)level, messageTemplate); - } - } - - public void Log( - LogEventLevel level, - string area, object source, - string messageTemplate, - T0 propertyValue0) - { - Contract.Requires(area != null); - Contract.Requires(messageTemplate != null); - - using (PushLogContextProperties(area, source)) - { - _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValue0); - } - } - - public void Log( - LogEventLevel level, - string area, - object source, - string messageTemplate, - T0 propertyValue0, - T1 propertyValue1) - { - Contract.Requires(area != null); - Contract.Requires(messageTemplate != null); - - using (PushLogContextProperties(area, source)) - { - _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValue0, propertyValue1); - } - } - - public void Log( - LogEventLevel level, - string area, - object source, - string messageTemplate, - T0 propertyValue0, - T1 propertyValue1, - T2 propertyValue2) - { - Contract.Requires(area != null); - Contract.Requires(messageTemplate != null); - - using (PushLogContextProperties(area, source)) - { - _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValue0, propertyValue1, propertyValue2); - } - } - - /// - public void Log( - AvaloniaLogEventLevel level, - string area, - object source, - string messageTemplate, - params object[] propertyValues) - { - Contract.Requires(area != null); - Contract.Requires(messageTemplate != null); - - using (PushLogContextProperties(area, source)) - { - _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValues); - } - } - - private static LogContextDisposable PushLogContextProperties(string area, object source) - { - return new LogContextDisposable( - LogContext.PushProperty("Area", area), - LogContext.PushProperty("SourceType", source?.GetType()), - LogContext.PushProperty("SourceHash", source?.GetHashCode()) - ); - } - - private readonly struct LogContextDisposable : IDisposable - { - private readonly IDisposable _areaDisposable; - private readonly IDisposable _sourceTypeDisposable; - private readonly IDisposable _sourceHashDisposable; - - public LogContextDisposable(IDisposable areaDisposable, IDisposable sourceTypeDisposable, IDisposable sourceHashDisposable) - { - _areaDisposable = areaDisposable; - _sourceTypeDisposable = sourceTypeDisposable; - _sourceHashDisposable = sourceHashDisposable; - } - - public void Dispose() - { - _areaDisposable.Dispose(); - _sourceTypeDisposable.Dispose(); - _sourceHashDisposable.Dispose(); - } - } - } -} diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index 73a1d586b5..523c5e7ff4 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -32,5 +32,4 @@ -