diff --git a/samples/RenderDemo/App.xaml.cs b/samples/RenderDemo/App.xaml.cs
index 923174d4c7..233160b025 100644
--- a/samples/RenderDemo/App.xaml.cs
+++ b/samples/RenderDemo/App.xaml.cs
@@ -1,5 +1,4 @@
using Avalonia;
-using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
@@ -22,6 +21,5 @@ namespace RenderDemo
.UsePlatformDetect()
.UseReactiveUI()
.LogToDebug();
-
}
}
diff --git a/samples/VirtualizationDemo/Program.cs b/samples/VirtualizationDemo/Program.cs
index 868a5e2640..6304730aa0 100644
--- a/samples/VirtualizationDemo/Program.cs
+++ b/samples/VirtualizationDemo/Program.cs
@@ -1,7 +1,6 @@
using System;
using Avalonia;
using Avalonia.Controls;
-using Avalonia.Logging.Serilog;
using Avalonia.ReactiveUI;
using Serilog;
diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs
index f387d7e0b6..646347119b 100644
--- a/src/Avalonia.Base/AvaloniaObject.cs
+++ b/src/Avalonia.Base/AvaloniaObject.cs
@@ -421,8 +421,7 @@ namespace Avalonia
throw new ArgumentException($"The property {property.Name} is readonly.");
}
- Logger.TryGet(LogEventLevel.Verbose)?.Log(
- LogArea.Property,
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Property)?.Log(
this,
"Bound {Property} to {Binding} with priority LocalValue",
property,
@@ -501,8 +500,7 @@ namespace Avalonia
if (change.IsEffectiveValueChange)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(
- LogArea.Property,
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Property)?.Log(
this,
"{Property} changed from {$Old} to {$Value} with priority {Priority}",
property,
@@ -586,8 +584,7 @@ namespace Avalonia
/// The binding error.
protected internal virtual void LogBindingError(AvaloniaProperty property, Exception e)
{
- Logger.TryGet(LogEventLevel.Warning)?.Log(
- LogArea.Binding,
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Property)?.Log(
this,
"Error in binding to {Target}.{Property}: {Message}",
this,
@@ -857,8 +854,7 @@ namespace Avalonia
/// The priority.
private void LogPropertySet(AvaloniaProperty property, T value, BindingPriority priority)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(
- LogArea.Property,
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Property)?.Log(
this,
"Set {Property} to {$Value} with priority {Priority}",
property,
diff --git a/src/Avalonia.Base/Data/Core/BindingExpression.cs b/src/Avalonia.Base/Data/Core/BindingExpression.cs
index 9721369e47..c4f61dfedb 100644
--- a/src/Avalonia.Base/Data/Core/BindingExpression.cs
+++ b/src/Avalonia.Base/Data/Core/BindingExpression.cs
@@ -168,8 +168,7 @@ namespace Avalonia.Data.Core
}
else
{
- Logger.TryGet(LogEventLevel.Error)?.Log(
- LogArea.Binding,
+ Logger.TryGet(LogEventLevel.Error, LogArea.Binding)?.Log(
this,
"Could not convert FallbackValue {FallbackValue} to {Type}",
_fallbackValue,
diff --git a/src/Avalonia.Base/Logging/DebugLogSink.cs b/src/Avalonia.Base/Logging/DebugLogSink.cs
index a26ecde305..3695afa860 100644
--- a/src/Avalonia.Base/Logging/DebugLogSink.cs
+++ b/src/Avalonia.Base/Logging/DebugLogSink.cs
@@ -19,7 +19,10 @@ namespace Avalonia.Logging
_areas = areas?.Count > 0 ? areas : null;
}
- public bool IsEnabled(LogEventLevel level) => level >= _level;
+ public bool IsEnabled(LogEventLevel level, string area)
+ {
+ return level >= _level && (_areas?.Contains(area) ?? true);
+ }
public void Log(LogEventLevel level, string area, object source, string messageTemplate)
{
@@ -61,8 +64,6 @@ namespace Avalonia.Logging
}
}
- private bool IsEnabled(LogEventLevel level, string area) => IsEnabled(level) && (_areas?.Contains(area) ?? true);
-
private static string Format(
string area,
string template,
diff --git a/src/Avalonia.Base/Logging/ILogSink.cs b/src/Avalonia.Base/Logging/ILogSink.cs
index 1649679b95..71268d5965 100644
--- a/src/Avalonia.Base/Logging/ILogSink.cs
+++ b/src/Avalonia.Base/Logging/ILogSink.cs
@@ -6,11 +6,12 @@ namespace Avalonia.Logging
public interface ILogSink
{
///
- /// Checks if given log level is enabled.
+ /// Checks if given log level and area is enabled.
///
/// The log event level.
+ /// The log area.
/// if given log level is enabled.
- bool IsEnabled(LogEventLevel level);
+ bool IsEnabled(LogEventLevel level, string area);
///
/// Logs an event.
diff --git a/src/Avalonia.Base/Logging/Logger.cs b/src/Avalonia.Base/Logging/Logger.cs
index 136f56a620..ed3fad93fc 100644
--- a/src/Avalonia.Base/Logging/Logger.cs
+++ b/src/Avalonia.Base/Logging/Logger.cs
@@ -14,36 +14,39 @@ namespace Avalonia.Logging
/// Checks if given log level is enabled.
///
/// The log event level.
+ /// The log area.
/// if given log level is enabled.
- public static bool IsEnabled(LogEventLevel level)
+ public static bool IsEnabled(LogEventLevel level, string area)
{
- return Sink?.IsEnabled(level) == true;
+ return Sink?.IsEnabled(level, area) == true;
}
///
/// Returns parametrized logging sink if given log level is enabled.
///
/// The log event level.
+ /// The area that the event originates from.
/// Log sink or if log level is not enabled.
- public static ParametrizedLogger? TryGet(LogEventLevel level)
+ public static ParametrizedLogger? TryGet(LogEventLevel level, string area)
{
- if (!IsEnabled(level))
+ if (!IsEnabled(level, area))
{
return null;
}
- return new ParametrizedLogger(Sink, level);
+ return new ParametrizedLogger(Sink, level, area);
}
///
/// Returns parametrized logging sink if given log level is enabled.
///
/// The log event level.
+ /// The area that the event originates from.
/// Log sink that is valid only if method returns .
/// if logger was obtained successfully.
- public static bool TryGet(LogEventLevel level, out ParametrizedLogger outLogger)
+ public static bool TryGet(LogEventLevel level, string area, out ParametrizedLogger outLogger)
{
- ParametrizedLogger? logger = TryGet(level);
+ ParametrizedLogger? logger = TryGet(level, area);
outLogger = logger.GetValueOrDefault();
diff --git a/src/Avalonia.Base/Logging/ParametrizedLogger.cs b/src/Avalonia.Base/Logging/ParametrizedLogger.cs
index 3dfb3c1ecf..adadb0f990 100644
--- a/src/Avalonia.Base/Logging/ParametrizedLogger.cs
+++ b/src/Avalonia.Base/Logging/ParametrizedLogger.cs
@@ -9,11 +9,13 @@ namespace Avalonia.Logging
{
private readonly ILogSink _sink;
private readonly LogEventLevel _level;
+ private readonly string _area;
- public ParametrizedLogger(ILogSink sink, LogEventLevel level)
+ public ParametrizedLogger(ILogSink sink, LogEventLevel level, string area)
{
_sink = sink;
_level = level;
+ _area = area;
}
///
@@ -24,58 +26,51 @@ namespace Avalonia.Logging
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate)
{
- _sink.Log(_level, area, source, messageTemplate);
+ _sink.Log(_level, _area, source, messageTemplate);
}
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
/// Message property value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate,
T0 propertyValue0)
{
- _sink.Log(_level, area, source, messageTemplate, propertyValue0);
+ _sink.Log(_level, _area, source, messageTemplate, propertyValue0);
}
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
/// Message property value.
/// Message property value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate,
T0 propertyValue0,
T1 propertyValue1)
{
- _sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1);
+ _sink.Log(_level, _area, source, messageTemplate, propertyValue0, propertyValue1);
}
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
/// Message property value.
@@ -83,20 +78,18 @@ namespace Avalonia.Logging
/// Message property value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate,
T0 propertyValue0,
T1 propertyValue1,
T2 propertyValue2)
{
- _sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ _sink.Log(_level, _area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
}
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
/// Message property value.
@@ -105,7 +98,6 @@ namespace Avalonia.Logging
/// Message property value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate,
T0 propertyValue0,
@@ -113,13 +105,12 @@ namespace Avalonia.Logging
T2 propertyValue2,
T3 propertyValue3)
{
- _sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3);
+ _sink.Log(_level, _area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3);
}
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
/// Message property value.
@@ -129,7 +120,6 @@ namespace Avalonia.Logging
/// Message property value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate,
T0 propertyValue0,
@@ -138,13 +128,12 @@ namespace Avalonia.Logging
T3 propertyValue3,
T4 propertyValue4)
{
- _sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3, propertyValue4);
+ _sink.Log(_level, _area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3, propertyValue4);
}
///
/// Logs an event.
///
- /// The area that the event originates.
/// The object from which the event originates.
/// The message template.
/// Message property value.
@@ -155,7 +144,6 @@ namespace Avalonia.Logging
/// Message property value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
- string area,
object source,
string messageTemplate,
T0 propertyValue0,
@@ -165,7 +153,7 @@ namespace Avalonia.Logging
T4 propertyValue4,
T5 propertyValue5)
{
- _sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3, propertyValue4, propertyValue5);
+ _sink.Log(_level, _area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3, propertyValue4, propertyValue5);
}
}
}
diff --git a/src/Avalonia.Base/Reactive/TypedBindingAdapter.cs b/src/Avalonia.Base/Reactive/TypedBindingAdapter.cs
index bd9b31b100..b99cef0f51 100644
--- a/src/Avalonia.Base/Reactive/TypedBindingAdapter.cs
+++ b/src/Avalonia.Base/Reactive/TypedBindingAdapter.cs
@@ -32,8 +32,7 @@ namespace Avalonia.Reactive
}
catch (InvalidCastException e)
{
- Logger.TryGet(LogEventLevel.Error)?.Log(
- LogArea.Binding,
+ Logger.TryGet(LogEventLevel.Error, LogArea.Binding)?.Log(
_target,
"Binding produced invalid value for {$Property} ({$PropertyType}): {$Value} ({$ValueType})",
_property.Name,
diff --git a/src/Avalonia.Controls/DropDown.cs b/src/Avalonia.Controls/DropDown.cs
index 9da803d16d..4e17f5bff5 100644
--- a/src/Avalonia.Controls/DropDown.cs
+++ b/src/Avalonia.Controls/DropDown.cs
@@ -9,7 +9,7 @@ namespace Avalonia.Controls
{
public DropDown()
{
- Logger.TryGet(LogEventLevel.Warning)?.Log(LogArea.Control, this, "DropDown is deprecated: Use ComboBox");
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Control)?.Log(this, "DropDown is deprecated: Use ComboBox");
}
Type IStyleable.StyleKey => typeof(ComboBox);
@@ -20,7 +20,7 @@ namespace Avalonia.Controls
{
public DropDownItem()
{
- Logger.TryGet(LogEventLevel.Warning)?.Log(LogArea.Control, this, "DropDownItem is deprecated: Use ComboBoxItem");
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Control)?.Log(this, "DropDownItem is deprecated: Use ComboBoxItem");
}
Type IStyleable.StyleKey => typeof(ComboBoxItem);
diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs
index 820d5777f5..d18cf7da71 100644
--- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs
+++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs
@@ -252,7 +252,7 @@ namespace Avalonia.Controls.Primitives
if (template != null)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Control, this, "Creating control template");
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Control)?.Log(this, "Creating control template");
var (child, nameScope) = template.Build(this);
ApplyTemplatedParent(child);
diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs
index 8335e03487..278bcd0426 100644
--- a/src/Avalonia.Controls/TopLevel.cs
+++ b/src/Avalonia.Controls/TopLevel.cs
@@ -452,8 +452,7 @@ namespace Avalonia.Controls
if (result == null)
{
- Logger.TryGet(LogEventLevel.Warning)?.Log(
- LogArea.Control,
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Control)?.Log(
this,
"Could not create {Service} : maybe Application.RegisterServices() wasn't called?",
typeof(T));
diff --git a/src/Avalonia.Layout/LayoutManager.cs b/src/Avalonia.Layout/LayoutManager.cs
index e8cb937997..de255331bc 100644
--- a/src/Avalonia.Layout/LayoutManager.cs
+++ b/src/Avalonia.Layout/LayoutManager.cs
@@ -76,12 +76,11 @@ namespace Avalonia.Layout
Stopwatch stopwatch = null;
const LogEventLevel timingLogLevel = LogEventLevel.Information;
- bool captureTiming = Logger.IsEnabled(timingLogLevel);
+ bool captureTiming = Logger.IsEnabled(timingLogLevel, LogArea.Layout);
if (captureTiming)
{
- Logger.TryGet(timingLogLevel)?.Log(
- LogArea.Layout,
+ Logger.TryGet(timingLogLevel, LogArea.Layout)?.Log(
this,
"Started layout pass. To measure: {Measure} To arrange: {Arrange}",
_toMeasure.Count,
@@ -119,7 +118,7 @@ namespace Avalonia.Layout
{
stopwatch.Stop();
- Logger.TryGet(timingLogLevel)?.Log(LogArea.Layout, this, "Layout pass finished in {Time}", stopwatch.Elapsed);
+ Logger.TryGet(timingLogLevel, LogArea.Layout)?.Log(this, "Layout pass finished in {Time}", stopwatch.Elapsed);
}
}
diff --git a/src/Avalonia.Layout/Layoutable.cs b/src/Avalonia.Layout/Layoutable.cs
index ce5200f4a4..0dd9a56485 100644
--- a/src/Avalonia.Layout/Layoutable.cs
+++ b/src/Avalonia.Layout/Layoutable.cs
@@ -326,7 +326,7 @@ namespace Avalonia.Layout
DesiredSize = desiredSize;
_previousMeasure = availableSize;
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Measure requested {DesiredSize}", DesiredSize);
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Layout)?.Log(this, "Measure requested {DesiredSize}", DesiredSize);
if (DesiredSize != previousDesiredSize)
{
@@ -353,7 +353,7 @@ namespace Avalonia.Layout
if (!IsArrangeValid || _previousArrange != rect)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Arrange to {Rect} ", rect);
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Layout)?.Log(this, "Arrange to {Rect} ", rect);
IsArrangeValid = true;
ArrangeCore(rect);
@@ -378,7 +378,7 @@ namespace Avalonia.Layout
{
if (IsMeasureValid)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Invalidated measure");
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Layout)?.Log(this, "Invalidated measure");
IsMeasureValid = false;
IsArrangeValid = false;
@@ -399,7 +399,7 @@ namespace Avalonia.Layout
{
if (IsArrangeValid)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Invalidated arrange");
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Layout)?.Log(this, "Invalidated arrange");
IsArrangeValid = false;
(VisualRoot as ILayoutRoot)?.LayoutManager?.InvalidateArrange(this);
diff --git a/src/Avalonia.Logging.Serilog/SerilogLogger.cs b/src/Avalonia.Logging.Serilog/SerilogLogger.cs
index e51925a0f2..0433516b81 100644
--- a/src/Avalonia.Logging.Serilog/SerilogLogger.cs
+++ b/src/Avalonia.Logging.Serilog/SerilogLogger.cs
@@ -31,7 +31,7 @@ namespace Avalonia.Logging.Serilog
Logger.Sink = new SerilogLogger(output);
}
- public bool IsEnabled(LogEventLevel level)
+ public bool IsEnabled(LogEventLevel level, string area)
{
return _output.IsEnabled((SerilogLogEventLevel)level);
}
diff --git a/src/Avalonia.OpenGL/EglGlPlatformFeature.cs b/src/Avalonia.OpenGL/EglGlPlatformFeature.cs
index cf3bce8756..f59c6b7751 100644
--- a/src/Avalonia.OpenGL/EglGlPlatformFeature.cs
+++ b/src/Avalonia.OpenGL/EglGlPlatformFeature.cs
@@ -34,7 +34,7 @@ namespace Avalonia.OpenGL
}
catch(Exception e)
{
- Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", null, "Unable to initialize EGL-based rendering: {0}", e);
+ Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log(null, "Unable to initialize EGL-based rendering: {0}", e);
return null;
}
}
diff --git a/src/Avalonia.OpenGL/OpenGlControlBase.cs b/src/Avalonia.OpenGL/OpenGlControlBase.cs
index 6268c81516..8567dcae20 100644
--- a/src/Avalonia.OpenGL/OpenGlControlBase.cs
+++ b/src/Avalonia.OpenGL/OpenGlControlBase.cs
@@ -94,7 +94,7 @@ namespace Avalonia.OpenGL
}
catch (Exception e)
{
- Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", "OpenGlControlBase",
+ Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
"Unable to initialize OpenGL: unable to create additional OpenGL context: {exception}", e);
_glFailed = true;
return false;
@@ -109,7 +109,7 @@ namespace Avalonia.OpenGL
{
_context.Dispose();
_context = null;
- Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", "OpenGlControlBase",
+ Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
"Unable to initialize OpenGL: unable to create OpenGlTextureBitmap: {exception}", e);
_glFailed = true;
return false;
@@ -138,7 +138,7 @@ namespace Avalonia.OpenGL
{
int code;
while ((code = gl.GetError()) != 0)
- Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", "OpenGlControlBase",
+ Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
"Unable to initialize OpenGL FBO: {code}", code);
_glFailed = true;
@@ -147,7 +147,7 @@ namespace Avalonia.OpenGL
}
catch(Exception e)
{
- Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", "OpenGlControlBase",
+ Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
"Unable to initialize OpenGL FBO: {exception}", e);
_glFailed = true;
}
diff --git a/src/Avalonia.Styling/StyledElement.cs b/src/Avalonia.Styling/StyledElement.cs
index bdd01924f1..05e031c9ec 100644
--- a/src/Avalonia.Styling/StyledElement.cs
+++ b/src/Avalonia.Styling/StyledElement.cs
@@ -689,8 +689,7 @@ namespace Avalonia
#if DEBUG
if (((INotifyCollectionChangedDebug)Classes).GetCollectionChangedSubscribers()?.Length > 0)
{
- Logger.TryGet(LogEventLevel.Warning)?.Log(
- LogArea.Control,
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Control)?.Log(
this,
"{Type} detached from logical tree but still has class listeners",
GetType());
diff --git a/src/Avalonia.Visuals/Animation/Animators/TransformAnimator.cs b/src/Avalonia.Visuals/Animation/Animators/TransformAnimator.cs
index 1f1590bdcd..59a52fe0bd 100644
--- a/src/Avalonia.Visuals/Animation/Animators/TransformAnimator.cs
+++ b/src/Avalonia.Visuals/Animation/Animators/TransformAnimator.cs
@@ -65,15 +65,13 @@ namespace Avalonia.Animation.Animators
}
}
- Logger.TryGet(LogEventLevel.Warning)?.Log(
- LogArea.Animations,
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Animations)?.Log(
control,
$"Cannot find the appropriate transform: \"{Property.OwnerType}\" in {control}.");
}
else
{
- Logger.TryGet(LogEventLevel.Error)?.Log(
- LogArea.Animations,
+ Logger.TryGet(LogEventLevel.Error, LogArea.Animations)?.Log(
control,
$"Cannot apply animation: Target property owner {Property.OwnerType} is not a Transform object.");
}
diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
index 59dd369956..8c020fc073 100644
--- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
+++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
@@ -287,7 +287,7 @@ namespace Avalonia.Rendering
}
catch (RenderTargetCorruptedException ex)
{
- Logger.TryGet(LogEventLevel.Information)?.Log("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
+ Logger.TryGet(LogEventLevel.Information, LogArea.Animations)?.Log(this, "Render target was corrupted. Exception: {0}", ex);
RenderTarget?.Dispose();
RenderTarget = null;
}
diff --git a/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs b/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
index c1c4b6bc99..78aef8bc72 100644
--- a/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
+++ b/src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
@@ -78,7 +78,7 @@ namespace Avalonia.Rendering
}
catch (RenderTargetCorruptedException ex)
{
- Logger.TryGet(LogEventLevel.Information)?.Log("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
+ Logger.TryGet(LogEventLevel.Information, LogArea.Animations)?.Log(this, "Render target was corrupted. Exception: {0}", ex);
_renderTarget.Dispose();
_renderTarget = null;
}
diff --git a/src/Avalonia.Visuals/Rendering/RenderLoop.cs b/src/Avalonia.Visuals/Rendering/RenderLoop.cs
index c2594658b9..789d028a3a 100644
--- a/src/Avalonia.Visuals/Rendering/RenderLoop.cs
+++ b/src/Avalonia.Visuals/Rendering/RenderLoop.cs
@@ -120,7 +120,7 @@ namespace Avalonia.Rendering
}
catch (Exception ex)
{
- Logger.TryGet(LogEventLevel.Error)?.Log(LogArea.Visual, this, "Exception in render update: {Error}", ex);
+ Logger.TryGet(LogEventLevel.Error, LogArea.Visual)?.Log(this, "Exception in render update: {Error}", ex);
}
}
}
@@ -136,7 +136,7 @@ namespace Avalonia.Rendering
}
catch (Exception ex)
{
- Logger.TryGet(LogEventLevel.Error)?.Log(LogArea.Visual, this, "Exception in render loop: {Error}", ex);
+ Logger.TryGet(LogEventLevel.Error, LogArea.Visual)?.Log(this, "Exception in render loop: {Error}", ex);
}
finally
{
diff --git a/src/Avalonia.Visuals/Visual.cs b/src/Avalonia.Visuals/Visual.cs
index bb9a4cf208..a22e8ac829 100644
--- a/src/Avalonia.Visuals/Visual.cs
+++ b/src/Avalonia.Visuals/Visual.cs
@@ -387,7 +387,7 @@ namespace Avalonia
/// The event args.
protected virtual void OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs e)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Visual, this, "Attached to visual tree");
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Visual)?.Log(this, "Attached to visual tree");
_visualRoot = e.Root;
@@ -424,7 +424,7 @@ namespace Avalonia
/// The event args.
protected virtual void OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
{
- Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Visual, this, "Detached from visual tree");
+ Logger.TryGet(LogEventLevel.Verbose, LogArea.Visual)?.Log(this, "Detached from visual tree");
_visualRoot = null;
@@ -501,8 +501,7 @@ namespace Avalonia
return;
}
- Logger.TryGet(LogEventLevel.Warning)?.Log(
- LogArea.Binding,
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Binding)?.Log(
this,
"Error in binding to {Target}.{Property}: {Message}",
this,
diff --git a/src/Avalonia.X11/Glx/GlxPlatformFeature.cs b/src/Avalonia.X11/Glx/GlxPlatformFeature.cs
index 046036fd68..e3250e6733 100644
--- a/src/Avalonia.X11/Glx/GlxPlatformFeature.cs
+++ b/src/Avalonia.X11/Glx/GlxPlatformFeature.cs
@@ -37,7 +37,7 @@ namespace Avalonia.X11.Glx
}
catch(Exception e)
{
- Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", null, "Unable to initialize GLX-based rendering: {0}", e);
+ Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log(null, "Unable to initialize GLX-based rendering: {0}", e);
return null;
}
}
diff --git a/src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs b/src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs
index cd67b27ff3..45ca1c4adc 100644
--- a/src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs
@@ -39,8 +39,7 @@ namespace Avalonia.Markup.Xaml.Converters
!property.IsAttached &&
!registry.IsRegistered(targetType, property))
{
- Logger.TryGet(LogEventLevel.Warning)?.Log(
- LogArea.Property,
+ Logger.TryGet(LogEventLevel.Warning, LogArea.Property)?.Log(
this,
"Property '{Owner}.{Name}' is not registered on '{Type}'.",
effectiveOwner,
diff --git a/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs b/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs
index ebb544bcca..0b0ed7b06a 100644
--- a/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs
+++ b/src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs
@@ -147,8 +147,7 @@ namespace Avalonia.Markup.Data
}
catch (Exception e)
{
- Logger.TryGet(LogEventLevel.Error)?.Log(
- LogArea.Property,
+ Logger.TryGet(LogEventLevel.Error, LogArea.Property)?.Log(
control,
"Error setting {Property} on {Target}: {Exception}",
Property.Name,
diff --git a/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs
index cca014bda5..e1f7aad1b2 100644
--- a/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs
+++ b/src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs
@@ -82,8 +82,7 @@ namespace Avalonia.Direct2D1.Media
}
catch (Exception ex)
{
- Logger.TryGet(LogEventLevel.Error)?.Log(
- LogArea.Visual,
+ Logger.TryGet(LogEventLevel.Error, LogArea.Visual)?.Log(
this,
"GeometrySink.Close exception: {Exception}",
ex);
diff --git a/tests/Avalonia.UnitTests/TestLogSink.cs b/tests/Avalonia.UnitTests/TestLogSink.cs
index 5c1dd293c4..e10292a59b 100644
--- a/tests/Avalonia.UnitTests/TestLogSink.cs
+++ b/tests/Avalonia.UnitTests/TestLogSink.cs
@@ -27,7 +27,7 @@ namespace Avalonia.UnitTests
return Disposable.Create(() => Logger.Sink = null);
}
- public bool IsEnabled(LogEventLevel level)
+ public bool IsEnabled(LogEventLevel level, string area)
{
return true;
}