Improved logging

This commit is contained in:
ClemensFischer 2025-08-22 11:06:37 +02:00
parent fce05c2ed1
commit 2d97f1f2c7
13 changed files with 57 additions and 31 deletions

View file

@ -44,6 +44,9 @@ namespace MapControl
public ImageSource ImageSource { get; set; }
}
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>());
public static readonly DependencyProperty SourcePathProperty =
DependencyPropertyHelper.Register<GroundOverlay, string>(nameof(SourcePath), null,
async (groundOverlay, oldValue, newValue) => await groundOverlay.LoadAsync(newValue));
@ -84,7 +87,7 @@ namespace MapControl
}
catch (Exception ex)
{
ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>()?.LogError(ex, "Failed loading from {path}", sourcePath);
Logger?.LogError(ex, "Failed loading from {path}", sourcePath);
}
}