Browse Source

Remove direct logging functions.

pull/3055/head
Dariusz Komosinski 7 years ago
parent
commit
5814bd7163
  1. 11
      src/Avalonia.Base/AvaloniaObject.cs
  2. 2
      src/Avalonia.Base/Data/Core/BindingExpression.cs
  3. 209
      src/Avalonia.Base/Logging/Logger.cs
  4. 66
      src/Avalonia.Base/Logging/ParametrizedLogger.cs
  5. 2
      src/Avalonia.Base/PriorityValue.cs
  6. 4
      src/Avalonia.Controls/DropDown.cs
  7. 2
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs
  8. 2
      src/Avalonia.Controls/Primitives/TemplatedControl.cs
  9. 2
      src/Avalonia.Controls/TopLevel.cs
  10. 7
      src/Avalonia.Layout/LayoutManager.cs
  11. 8
      src/Avalonia.Layout/Layoutable.cs
  12. 2
      src/Avalonia.OpenGL/EglGlPlatformFeature.cs
  13. 4
      src/Avalonia.Styling/StyledElement.cs
  14. 4
      src/Avalonia.Visuals/Animation/Animators/TransformAnimator.cs
  15. 3
      src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
  16. 3
      src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
  17. 4
      src/Avalonia.Visuals/Rendering/RenderLoop.cs
  18. 7
      src/Avalonia.Visuals/Visual.cs
  19. 2
      src/Avalonia.X11/Glx/GlxPlatformFeature.cs
  20. 2
      src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs
  21. 2
      src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs
  22. 2
      src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs

11
src/Avalonia.Base/AvaloniaObject.cs

@ -333,7 +333,7 @@ namespace Avalonia
throw new ArgumentException($"The property {property.Name} is readonly.");
}
if (Logger.TryGetLogger(LogEventLevel.Verbose, out var logger))
if (Logger.TryGet(LogEventLevel.Verbose, out var logger))
{
var description = GetDescription(source);
@ -354,7 +354,7 @@ namespace Avalonia
}
else
{
if (Logger.TryGetLogger(LogEventLevel.Verbose, out var logger))
if (Logger.TryGet(LogEventLevel.Verbose, out var logger))
{
var description = GetDescription(source);
@ -414,7 +414,7 @@ namespace Avalonia
{
RaisePropertyChanged(property, oldValue, newValue, (BindingPriority)priority);
Logger.TryGetLogger(LogEventLevel.Verbose)?.Log(
Logger.TryGet(LogEventLevel.Verbose)?.Log(
LogArea.Property,
this,
"{Property} changed from {$Old} to {$Value} with priority {Priority}",
@ -466,8 +466,7 @@ namespace Avalonia
/// <param name="e">The binding error.</param>
protected internal virtual void LogBindingError(AvaloniaProperty property, Exception e)
{
Logger.Log(
LogEventLevel.Warning,
Logger.TryGet(LogEventLevel.Warning)?.Log(
LogArea.Binding,
this,
"Error in binding to {Target}.{Property}: {Message}",
@ -820,7 +819,7 @@ namespace Avalonia
/// <param name="priority">The priority.</param>
private void LogPropertySet(AvaloniaProperty property, object value, BindingPriority priority)
{
Logger.TryGetLogger(LogEventLevel.Verbose)?.Log(
Logger.TryGet(LogEventLevel.Verbose)?.Log(
LogArea.Property,
this,
"Set {Property} to {$Value} with priority {Priority}",

2
src/Avalonia.Base/Data/Core/BindingExpression.cs

@ -165,7 +165,7 @@ namespace Avalonia.Data.Core
}
else
{
Logger.Error(
Logger.TryGet(LogEventLevel.Error)?.Log(
LogArea.Binding,
this,
"Could not convert FallbackValue {FallbackValue} to {Type}",

209
src/Avalonia.Base/Logging/Logger.cs

@ -1,8 +1,6 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Runtime.CompilerServices;
namespace Avalonia.Logging
{
/// <summary>
@ -30,7 +28,7 @@ namespace Avalonia.Logging
/// </summary>
/// <param name="level">The log event level.</param>
/// <returns>Log sink or <see langword="null"/> if log level is not enabled.</returns>
public static ParametrizedLogger? TryGetLogger(LogEventLevel level)
public static ParametrizedLogger? TryGet(LogEventLevel level)
{
if (!IsEnabled(level))
{
@ -46,214 +44,13 @@ namespace Avalonia.Logging
/// <param name="level">The log event level.</param>
/// <param name="outLogger">Log sink that is valid only if method returns <see langword="true"/>.</param>
/// <returns><see langword="true"/> if logger was obtained successfully.</returns>
public static bool TryGetLogger(LogEventLevel level, out ParametrizedLogger outLogger)
public static bool TryGet(LogEventLevel level, out ParametrizedLogger outLogger)
{
ParametrizedLogger? logger = TryGetLogger(level);
ParametrizedLogger? logger = TryGet(level);
outLogger = logger.GetValueOrDefault();
return logger.HasValue;
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="level">The log event level.</param>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Log(
LogEventLevel level,
string area,
object source,
string messageTemplate)
{
Sink?.Log(level, area, source, messageTemplate);
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="level">The log event level.</param>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValue0">Message property value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Log<T0>(
LogEventLevel level,
string area,
object source,
string messageTemplate,
T0 propertyValue0)
{
Sink?.Log(level, area, source, messageTemplate, propertyValue0);
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="level">The log event level.</param>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValue0">Message property value.</param>
/// <param name="propertyValue1">Message property value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Log<T0, T1>(
LogEventLevel level,
string area,
object source,
string messageTemplate,
T0 propertyValue0,
T1 propertyValue1)
{
Sink?.Log(level, area, source, messageTemplate, propertyValue0, propertyValue1);
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="level">The log event level.</param>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValue0">Message property value.</param>
/// <param name="propertyValue1">Message property value.</param>
/// <param name="propertyValue2">Message property value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Log<T0, T1, T2>(
LogEventLevel level,
string area,
object source,
string messageTemplate,
T0 propertyValue0,
T1 propertyValue1,
T2 propertyValue2)
{
Sink?.Log(level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="level">The log event level.</param>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Log(
LogEventLevel level,
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Sink?.Log(level, area, source, messageTemplate, propertyValues);
}
/// <summary>
/// Logs an event with the <see cref="LogEventLevel.Verbose"/> level.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Verbose(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Log(LogEventLevel.Verbose, area, source, messageTemplate, propertyValues);
}
/// <summary>
/// Logs an event with the <see cref="LogEventLevel.Debug"/> level.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Debug(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Log(LogEventLevel.Debug, area, source, messageTemplate, propertyValues);
}
/// <summary>
/// Logs an event with the <see cref="LogEventLevel.Information"/> level.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Information(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Log(LogEventLevel.Information, area, source, messageTemplate, propertyValues);
}
/// <summary>
/// Logs an event with the <see cref="LogEventLevel.Warning"/> level.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Warning(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Log(LogEventLevel.Warning, area, source, messageTemplate, propertyValues);
}
/// <summary>
/// Logs an event with the <see cref="LogEventLevel.Error"/> level.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Error(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Log(LogEventLevel.Error, area, source, messageTemplate, propertyValues);
}
/// <summary>
/// Logs an event with the <see cref="LogEventLevel.Fatal"/> level.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Fatal(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
{
Log(LogEventLevel.Fatal, area, source, messageTemplate, propertyValues);
}
}
}

66
src/Avalonia.Base/Logging/ParametrizedLogger.cs

@ -102,15 +102,73 @@ namespace Avalonia.Logging
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValues">The message property values.</param>
/// <param name="propertyValue0">Message property value.</param>
/// <param name="propertyValue1">Message property value.</param>
/// <param name="propertyValue2">Message property value.</param>
/// <param name="propertyValue3">Message property value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log(
public void Log<T0, T1, T2, T3>(
string area,
object source,
string messageTemplate,
T0 propertyValue0,
T1 propertyValue1,
T2 propertyValue2,
T3 propertyValue3)
{
_sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3);
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValue0">Message property value.</param>
/// <param name="propertyValue1">Message property value.</param>
/// <param name="propertyValue2">Message property value.</param>
/// <param name="propertyValue3">Message property value.</param>
/// <param name="propertyValue4">Message property value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log<T0, T1, T2, T3, T4>(
string area,
object source,
string messageTemplate,
params object[] propertyValues)
T0 propertyValue0,
T1 propertyValue1,
T2 propertyValue2,
T3 propertyValue3,
T4 propertyValue4)
{
_sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3, propertyValue4);
}
/// <summary>
/// Logs an event.
/// </summary>
/// <param name="area">The area that the event originates.</param>
/// <param name="source">The object from which the event originates.</param>
/// <param name="messageTemplate">The message template.</param>
/// <param name="propertyValue0">Message property value.</param>
/// <param name="propertyValue1">Message property value.</param>
/// <param name="propertyValue2">Message property value.</param>
/// <param name="propertyValue3">Message property value.</param>
/// <param name="propertyValue4">Message property value.</param>
/// <param name="propertyValue5">Message property value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Log<T0, T1, T2, T3, T4, T5>(
string area,
object source,
string messageTemplate,
T0 propertyValue0,
T1 propertyValue1,
T2 propertyValue2,
T3 propertyValue3,
T4 propertyValue4,
T5 propertyValue5)
{
_sink.Log(_level, area, source, messageTemplate, propertyValues);
_sink.Log(_level, area, source, messageTemplate, propertyValue0, propertyValue1, propertyValue2, propertyValue3, propertyValue4, propertyValue5);
}
}
}

2
src/Avalonia.Base/PriorityValue.cs

@ -301,7 +301,7 @@ namespace Avalonia
}
else
{
Logger.Error(
Logger.TryGet(LogEventLevel.Error)?.Log(
LogArea.Binding,
Owner,
"Binding produced invalid value for {$Property} ({$PropertyType}): {$Value} ({$ValueType})",

4
src/Avalonia.Controls/DropDown.cs

@ -9,7 +9,7 @@ namespace Avalonia.Controls
{
public DropDown()
{
Logger.Warning(LogArea.Control, this, "DropDown is deprecated: Use ComboBox");
Logger.TryGet(LogEventLevel.Warning)?.Log(LogArea.Control, this, "DropDown is deprecated: Use ComboBox");
}
Type IStyleable.StyleKey => typeof(ComboBox);
@ -20,7 +20,7 @@ namespace Avalonia.Controls
{
public DropDownItem()
{
Logger.Warning(LogArea.Control, this, "DropDownItem is deprecated: Use ComboBoxItem");
Logger.TryGet(LogEventLevel.Warning)?.Log(LogArea.Control, this, "DropDownItem is deprecated: Use ComboBoxItem");
}
Type IStyleable.StyleKey => typeof(ComboBoxItem);

2
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

@ -1062,7 +1062,7 @@ namespace Avalonia.Controls.Primitives
}
catch (Exception ex)
{
Logger.Error(
Logger.TryGet(LogEventLevel.Error)?.Log(
LogArea.Property,
this,
"Error thrown updating SelectedItems: {Error}",

2
src/Avalonia.Controls/Primitives/TemplatedControl.cs

@ -255,7 +255,7 @@ namespace Avalonia.Controls.Primitives
if (template != null)
{
Logger.Log(LogEventLevel.Verbose, LogArea.Control, this, "Creating control template");
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Control, this, "Creating control template");
var (child, nameScope) = template.Build(this);
ApplyTemplatedParent(child);

2
src/Avalonia.Controls/TopLevel.cs

@ -330,7 +330,7 @@ namespace Avalonia.Controls
if (result == null)
{
Logger.Warning(
Logger.TryGet(LogEventLevel.Warning)?.Log(
LogArea.Control,
this,
"Could not create {Service} : maybe Application.RegisterServices() wasn't called?",

7
src/Avalonia.Layout/LayoutManager.cs

@ -72,11 +72,12 @@ namespace Avalonia.Layout
Stopwatch stopwatch = null;
bool captureTiming = Logger.IsEnabled(LogEventLevel.Information);
const LogEventLevel timingLogLevel = LogEventLevel.Information;
bool captureTiming = Logger.IsEnabled(timingLogLevel);
if (captureTiming)
{
Logger.Log(LogEventLevel.Information,
Logger.TryGet(timingLogLevel)?.Log(
LogArea.Layout,
this,
"Started layout pass. To measure: {Measure} To arrange: {Arrange}",
@ -115,7 +116,7 @@ namespace Avalonia.Layout
{
stopwatch.Stop();
Logger.Information(LogArea.Layout, this, "Layout pass finished in {Time}", stopwatch.Elapsed);
Logger.TryGet(timingLogLevel)?.Log(LogArea.Layout, this, "Layout pass finished in {Time}", stopwatch.Elapsed);
}
}

8
src/Avalonia.Layout/Layoutable.cs

@ -329,7 +329,7 @@ namespace Avalonia.Layout
DesiredSize = desiredSize;
_previousMeasure = availableSize;
Logger.Log(LogEventLevel.Verbose, LogArea.Layout, this, "Measure requested {DesiredSize}", DesiredSize);
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Measure requested {DesiredSize}", DesiredSize);
if (DesiredSize != previousDesiredSize)
{
@ -356,7 +356,7 @@ namespace Avalonia.Layout
if (!IsArrangeValid || _previousArrange != rect)
{
Logger.Log(LogEventLevel.Verbose, LogArea.Layout, this, "Arrange to {Rect} ", rect);
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Arrange to {Rect} ", rect);
IsArrangeValid = true;
ArrangeCore(rect);
@ -381,7 +381,7 @@ namespace Avalonia.Layout
{
if (IsMeasureValid)
{
Logger.Log(LogEventLevel.Verbose, LogArea.Layout, this, "Invalidated measure");
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Invalidated measure");
IsMeasureValid = false;
IsArrangeValid = false;
@ -402,7 +402,7 @@ namespace Avalonia.Layout
{
if (IsArrangeValid)
{
Logger.Log(LogEventLevel.Verbose, LogArea.Layout, this, "Invalidated arrange");
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Layout, this, "Invalidated arrange");
IsArrangeValid = false;
(VisualRoot as ILayoutRoot)?.LayoutManager?.InvalidateArrange(this);

2
src/Avalonia.OpenGL/EglGlPlatformFeature.cs

@ -31,7 +31,7 @@ namespace Avalonia.OpenGL
}
catch(Exception e)
{
Logger.Error("OpenGL", null, "Unable to initialize EGL-based rendering: {0}", e);
Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", null, "Unable to initialize EGL-based rendering: {0}", e);
return null;
}
}

4
src/Avalonia.Styling/StyledElement.cs

@ -743,11 +743,11 @@ namespace Avalonia
#if DEBUG
if (((INotifyCollectionChangedDebug)_classes).GetCollectionChangedSubscribers()?.Length > 0)
{
Logger.Warning(
Logger.TryGet(LogEventLevel.Warning)?.Log(
LogArea.Control,
this,
"{Type} detached from logical tree but still has class listeners",
this.GetType());
GetType());
}
#endif
}

4
src/Avalonia.Visuals/Animation/Animators/TransformAnimator.cs

@ -65,14 +65,14 @@ namespace Avalonia.Animation.Animators
}
}
Logger.Warning(
Logger.TryGet(LogEventLevel.Warning)?.Log(
LogArea.Animations,
control,
$"Cannot find the appropriate transform: \"{Property.OwnerType}\" in {control}.");
}
else
{
Logger.Error(
Logger.TryGet(LogEventLevel.Error)?.Log(
LogArea.Animations,
control,
$"Cannot apply animation: Target property owner {Property.OwnerType} is not a Transform object.");

3
src/Avalonia.Visuals/Rendering/DeferredRenderer.cs

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Avalonia.Logging;
using Avalonia.Media;
using Avalonia.Media.Immutable;
using Avalonia.Platform;
@ -269,7 +270,7 @@ namespace Avalonia.Rendering
}
catch (RenderTargetCorruptedException ex)
{
Logging.Logger.Information("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
Logger.TryGet(LogEventLevel.Information)?.Log("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
RenderTarget?.Dispose();
RenderTarget = null;
}

3
src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Logging;
using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.VisualTree;
@ -80,7 +81,7 @@ namespace Avalonia.Rendering
}
catch (RenderTargetCorruptedException ex)
{
Logging.Logger.Information("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
Logger.TryGet(LogEventLevel.Information)?.Log("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
_renderTarget.Dispose();
_renderTarget = null;
}

4
src/Avalonia.Visuals/Rendering/RenderLoop.cs

@ -120,7 +120,7 @@ namespace Avalonia.Rendering
}
catch (Exception ex)
{
Logger.Error(LogArea.Visual, this, "Exception in render update: {Error}", ex);
Logger.TryGet(LogEventLevel.Error)?.Log(LogArea.Visual, this, "Exception in render update: {Error}", ex);
}
}
}
@ -136,7 +136,7 @@ namespace Avalonia.Rendering
}
catch (Exception ex)
{
Logger.Error(LogArea.Visual, this, "Exception in render loop: {Error}", ex);
Logger.TryGet(LogEventLevel.Error)?.Log(LogArea.Visual, this, "Exception in render loop: {Error}", ex);
}
finally
{

7
src/Avalonia.Visuals/Visual.cs

@ -359,7 +359,7 @@ namespace Avalonia
/// <param name="e">The event args.</param>
protected virtual void OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs e)
{
Logger.Log(LogEventLevel.Verbose, LogArea.Visual, this, "Attached to visual tree");
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Visual, this, "Attached to visual tree");
_visualRoot = e.Root;
@ -388,7 +388,7 @@ namespace Avalonia
/// <param name="e">The event args.</param>
protected virtual void OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
{
Logger.Log(LogEventLevel.Verbose, LogArea.Visual, this, "Detached from visual tree");
Logger.TryGet(LogEventLevel.Verbose)?.Log(LogArea.Visual, this, "Detached from visual tree");
_visualRoot = null;
@ -453,8 +453,7 @@ namespace Avalonia
return;
}
Logger.Log(
LogEventLevel.Warning,
Logger.TryGet(LogEventLevel.Warning)?.Log(
LogArea.Binding,
this,
"Error in binding to {Target}.{Property}: {Message}",

2
src/Avalonia.X11/Glx/GlxPlatformFeature.cs

@ -36,7 +36,7 @@ namespace Avalonia.X11.Glx
}
catch(Exception e)
{
Logger.Error("OpenGL", null, "Unable to initialize GLX-based rendering: {0}", e);
Logger.TryGet(LogEventLevel.Error)?.Log("OpenGL", null, "Unable to initialize GLX-based rendering: {0}", e);
return null;
}
}

2
src/Markup/Avalonia.Markup.Xaml/Converters/AvaloniaPropertyTypeConverter.cs

@ -42,7 +42,7 @@ namespace Avalonia.Markup.Xaml.Converters
!property.IsAttached &&
!registry.IsRegistered(targetType, property))
{
Logger.Warning(
Logger.TryGet(LogEventLevel.Warning)?.Log(
LogArea.Property,
this,
"Property '{Owner}.{Name}' is not registered on '{Type}'.",

2
src/Markup/Avalonia.Markup/Markup/Data/DelayedBinding.cs

@ -150,7 +150,7 @@ namespace Avalonia.Markup.Data
}
catch (Exception e)
{
Logger.Error(
Logger.TryGet(LogEventLevel.Error)?.Log(
LogArea.Property,
control,
"Error setting {Property} on {Target}: {Exception}",

2
src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs

@ -85,7 +85,7 @@ namespace Avalonia.Direct2D1.Media
}
catch (Exception ex)
{
Logger.Error(
Logger.TryGet(LogEventLevel.Error)?.Log(
LogArea.Visual,
this,
"GeometrySink.Close exception: {Exception}",

Loading…
Cancel
Save