Steven Kirk преди 5 години
родител
ревизия
55868ce690

+ 0 - 27
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

+ 0 - 1
build/CoreLibraries.props

@@ -7,7 +7,6 @@
       <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Input/Avalonia.Input.csproj" />
       <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Interactivity/Avalonia.Interactivity.csproj" />
       <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Layout/Avalonia.Layout.csproj" />
-      <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj" />
       <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Visuals/Avalonia.Visuals.csproj" />
       <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Styling/Avalonia.Styling.csproj" />
       <ProjectReference Include="$(MSBuildThisFileDirectory)/../src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj" />

+ 0 - 7
build/Serilog.props

@@ -1,7 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <PackageReference Include="Serilog" Version="2.5.0" />
-    <PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" />
-    <PackageReference Include="Serilog.Sinks.Debug" Version="1.0.0" />
-  </ItemGroup>
-</Project>

+ 1 - 3
build/readme.md

@@ -9,8 +9,6 @@
 <Import Project="..\..\build\Moq.props" />
 <Import Project="..\..\build\NetCore.props" />
 <Import Project="..\..\build\Rx.props" />
-<Import Project="..\..\build\Serilog.props" />
-<Import Project="..\..\build\Serilog.Sinks.Trace.props" />
 <Import Project="..\..\build\SharpDX.props" />
 <Import Project="..\..\build\SkiaSharp.Desktop.props" />
 <Import Project="..\..\build\SkiaSharp.props" />
@@ -22,4 +20,4 @@
 
 ```XML
 <Import Project="..\..\build\UnitTests.NetCore.targets" />
-```
+```

+ 0 - 2
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
 {

+ 0 - 1
samples/BindingDemo/BindingDemo.csproj

@@ -10,7 +10,6 @@
   </ItemGroup>
   <Import Project="..\..\build\SampleApp.props" />
   <Import Project="..\..\build\EmbedXaml.props" />
-  <Import Project="..\..\build\Serilog.props" />
   <Import Project="..\..\build\Rx.props" />
   <Import Project="..\..\build\ReactiveUI.props" />
   <Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" />

+ 0 - 1
samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj

@@ -10,6 +10,5 @@
   </ItemGroup>
 
   <Import Project="..\..\build\SampleApp.props" />
-  <Import Project="..\..\build\Serilog.props" />
   <Import Project="..\..\build\NetFX.props" />
 </Project>

+ 0 - 2
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
 {

+ 0 - 1
samples/ControlCatalog/ControlCatalog.csproj

@@ -28,6 +28,5 @@
     <ProjectReference Include="..\..\src\Avalonia.Controls.DataGrid\Avalonia.Controls.DataGrid.csproj" />
   </ItemGroup>
   
-  <Import Project="..\..\build\Serilog.props" />
   <Import Project="..\..\build\BuildTargets.targets" />
 </Project>

+ 0 - 1
samples/RenderDemo/RenderDemo.csproj

@@ -13,7 +13,6 @@
   </ItemGroup>
   <Import Project="..\..\build\SampleApp.props" />
   <Import Project="..\..\build\EmbedXaml.props" />
-  <Import Project="..\..\build\Serilog.props" />
   <Import Project="..\..\build\Rx.props" />
   <Import Project="..\..\build\ReactiveUI.props" />
   <Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" />

+ 0 - 1
samples/VirtualizationDemo/Program.cs

@@ -2,7 +2,6 @@
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.ReactiveUI;
-using Serilog;
 
 namespace VirtualizationDemo
 {

+ 0 - 1
samples/VirtualizationDemo/VirtualizationDemo.csproj

@@ -10,7 +10,6 @@
   </ItemGroup>
   <Import Project="..\..\build\SampleApp.props" />
   <Import Project="..\..\build\EmbedXaml.props" />
-  <Import Project="..\..\build\Serilog.props" />
   <Import Project="..\..\build\Rx.props" />
   <Import Project="..\..\build\ReactiveUI.props" />
   <Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" />

+ 0 - 1
samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj

@@ -26,7 +26,6 @@
         <ProjectReference Include="..\..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" />
         <ProjectReference Include="..\..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" />
     </ItemGroup>
-    <Import Project="..\..\..\build\Serilog.props" />
     <Import Project="..\..\..\build\Rx.props" />
     <Import Project="..\..\..\build\ReferenceCoreLibraries.props" />
 </Project>

+ 0 - 1
src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj

@@ -149,7 +149,6 @@
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
-  <Import Project="..\..\..\build\Serilog.props" />
   <Import Project="..\..\..\build\Base.props" />
   <Import Project="..\..\..\build\Rx.props" />
   <Import Project="..\..\..\build\System.Memory.props" />

+ 0 - 10
src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj

@@ -1,10 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-  </PropertyGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" />
-    <ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj" />
-  </ItemGroup>  
-  <Import Project="..\..\build\Serilog.props" />
-</Project>

+ 0 - 103
src/Avalonia.Logging.Serilog/SerilogExtensions.cs

@@ -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
-{
-    /// <summary>
-    /// Extension methods for Serilog logging.
-    /// </summary>
-    public static class SerilogExtensions
-    {
-        private const string DefaultTemplate = "[{Area}] {Message} ({SourceType} #{SourceHash})";
-
-        /// <summary>
-        /// Logs Avalonia events to the <see cref="System.Diagnostics.Debug"/> sink.
-        /// </summary>
-        /// <typeparam name="T">The application class type.</typeparam>
-        /// <param name="builder">The app builder instance.</param>
-        /// <param name="level">The minimum level to log.</param>
-        /// <returns>The app builder instance.</returns>
-        public static T LogToDebug<T>(
-            this T builder,
-            LogEventLevel level = LogEventLevel.Warning)
-                where T : AppBuilderBase<T>, new()
-        {
-            SerilogLogger.Initialize(new LoggerConfiguration()
-                .MinimumLevel.Is((SerilogLevel)level)
-                .Enrich.FromLogContext()
-                .WriteTo.Debug(outputTemplate: DefaultTemplate)
-                .CreateLogger());
-            return builder;
-        }
-
-        /// <summary>
-        /// Logs Avalonia events to the <see cref="System.Diagnostics.Debug"/> sink.
-        /// </summary>
-        /// <typeparam name="T">The application class type.</typeparam>
-        /// <param name="builder">The app builder instance.</param>
-        /// <param name="area">The area to log. Valid values are listed in <see cref="LogArea"/>.</param>
-        /// <param name="level">The minimum level to log.</param>
-        /// <returns>The app builder instance.</returns>
-        public static T LogToDebug<T>(
-            this T builder,
-            string area,
-            LogEventLevel level = LogEventLevel.Warning)
-                where T : AppBuilderBase<T>, new()
-        {
-            SerilogLogger.Initialize(new LoggerConfiguration()
-                .MinimumLevel.Is((SerilogLevel)level)
-                .Filter.ByIncludingOnly(Matching.WithProperty("Area", area))
-                .Enrich.FromLogContext()
-                .WriteTo.Debug(outputTemplate: DefaultTemplate)
-                .CreateLogger());
-            return builder;
-        }
-
-        /// <summary>
-        /// Logs Avalonia events to the <see cref="System.Diagnostics.Trace"/> sink.
-        /// </summary>
-        /// <typeparam name="T">The application class type.</typeparam>
-        /// <param name="builder">The app builder instance.</param>
-        /// <param name="level">The minimum level to log.</param>
-        /// <returns>The app builder instance.</returns>
-        public static T LogToTrace<T>(
-            this T builder,
-            LogEventLevel level = LogEventLevel.Warning)
-                where T : AppBuilderBase<T>, new()
-        {
-            SerilogLogger.Initialize(new LoggerConfiguration()
-                .MinimumLevel.Is((SerilogLevel)level)
-                .Enrich.FromLogContext()
-                .WriteTo.Trace(outputTemplate: DefaultTemplate)
-                .CreateLogger());
-            return builder;
-        }
-
-        /// <summary>
-        /// Logs Avalonia events to the <see cref="System.Diagnostics.Trace"/> sink.
-        /// </summary>
-        /// <typeparam name="T">The application class type.</typeparam>
-        /// <param name="builder">The app builder instance.</param>
-        /// <param name="area">The area to log. Valid values are listed in <see cref="LogArea"/>.</param>
-        /// <param name="level">The minimum level to log.</param>
-        /// <returns>The app builder instance.</returns>
-        public static T LogToTrace<T>(
-            this T builder,
-            string area,
-            LogEventLevel level = LogEventLevel.Warning)
-                where T : AppBuilderBase<T>, new()
-        {
-            SerilogLogger.Initialize(new LoggerConfiguration()
-                .MinimumLevel.Is((SerilogLevel)level)
-                .Filter.ByIncludingOnly(Matching.WithProperty("Area", area))
-                .Enrich.FromLogContext()
-                .WriteTo.Trace(outputTemplate: DefaultTemplate)
-                .CreateLogger());
-            return builder;
-        }
-    }
-}

+ 0 - 151
src/Avalonia.Logging.Serilog/SerilogLogger.cs

@@ -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
-{
-    /// <summary>
-    /// Sends log output to serilog.
-    /// </summary>
-    public class SerilogLogger : ILogSink
-    {
-        private readonly ILogger _output;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="SerilogLogger"/> class.
-        /// </summary>
-        /// <param name="output">The serilog logger to use.</param>
-        public SerilogLogger(ILogger output)
-        {
-            _output = output;
-        }
-
-        /// <summary>
-        /// Initializes the Avalonia logging with a new instance of a <see cref="SerilogLogger"/>.
-        /// </summary>
-        /// <param name="output">The serilog logger to use.</param>
-        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<ArgumentNullException>(area != null);
-            Contract.Requires<ArgumentNullException>(messageTemplate != null);
-
-            using (PushLogContextProperties(area, source))
-            {
-                _output.Write((SerilogLogEventLevel)level, messageTemplate);
-            }
-        }
-
-        public void Log<T0>(
-            LogEventLevel level, 
-            string area, object source,
-            string messageTemplate, 
-            T0 propertyValue0)
-        {
-            Contract.Requires<ArgumentNullException>(area != null);
-            Contract.Requires<ArgumentNullException>(messageTemplate != null);
-
-            using (PushLogContextProperties(area, source))
-            {
-                _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValue0);
-            }
-        }
-
-        public void Log<T0, T1>(
-            LogEventLevel level, 
-            string area,
-            object source,
-            string messageTemplate,
-            T0 propertyValue0,
-            T1 propertyValue1)
-        {
-            Contract.Requires<ArgumentNullException>(area != null);
-            Contract.Requires<ArgumentNullException>(messageTemplate != null);
-
-            using (PushLogContextProperties(area, source))
-            {
-                _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValue0, propertyValue1);
-            }
-        }
-
-        public void Log<T0, T1, T2>(
-            LogEventLevel level, 
-            string area, 
-            object source, 
-            string messageTemplate, 
-            T0 propertyValue0,
-            T1 propertyValue1, 
-            T2 propertyValue2)
-        {
-            Contract.Requires<ArgumentNullException>(area != null);
-            Contract.Requires<ArgumentNullException>(messageTemplate != null);
-
-            using (PushLogContextProperties(area, source))
-            {
-                _output.Write((SerilogLogEventLevel)level, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
-            }
-        }
-
-        /// <inheritdoc/>
-        public void Log(
-            AvaloniaLogEventLevel level,
-            string area,
-            object source,
-            string messageTemplate,
-            params object[] propertyValues)
-        {
-            Contract.Requires<ArgumentNullException>(area != null);
-            Contract.Requires<ArgumentNullException>(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();
-            }
-        }
-    }
-}

+ 0 - 1
tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj

@@ -32,5 +32,4 @@
     <ProjectReference Include="..\..\src\Avalonia.Desktop\Avalonia.Desktop.csproj" />
   </ItemGroup>
   <Import Project="..\..\build\BuildTargets.targets" />
-  <Import Project="..\..\build\Serilog.props" />
 </Project>