Fixed Warnings
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Drawing;
|
||||
using Common.Core;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using AvaloniaLoggingNoDI.Extensions;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace AvaloniaLoggingNoDI.Helpers;
|
||||
|
||||
@@ -15,8 +16,8 @@ public static class LoggingHelper
|
||||
{
|
||||
// retrieve the log level from 'appsettings'
|
||||
string value = AppSettings<string>.Current("Logging:LogLevel", "Default") ?? "Information";
|
||||
Enum.TryParse(value, out LogLevel logLevel);
|
||||
|
||||
var success = Enum.TryParse(value, out LogLevel logLevel);
|
||||
Debug.Assert(success, $"Failed to parse log level from appsettings. Value: '{value}'");
|
||||
// wire up the loggers
|
||||
Factory = LoggerFactory.Create(builder => builder
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace AvaloniaLoggingNoDI;
|
||||
|
||||
internal class Program
|
||||
internal sealed class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
Title="C# AVALONIA MINIMAL | LogViewer Control Example - Dot Net 7.0"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="AvaloniaLoggingNoDI-MsLogger"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
WindowStartupLocation="CenterScreen" Height="634" Width="600">
|
||||
|
||||
<control:LogViewerControl x:Name="LogViewerControl" />
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Threading;
|
||||
|
||||
namespace AvaloniaLoggingNoDI.Views;
|
||||
|
||||
public partial class MainWindow : Window, ILogDataStoreImpl
|
||||
public partial class MainWindow : Window, ILogDataStoreCore
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
@@ -21,7 +21,7 @@ public partial class MainWindow : Window, ILogDataStoreImpl
|
||||
|
||||
// Get the Launch mode
|
||||
bool isDevelopment = string.Equals(Environment.GetEnvironmentVariable("DOTNET_MODIFIABLE_ASSEMBLIES"), "debug",
|
||||
StringComparison.InvariantCultureIgnoreCase);
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// initialize a logger & EventId
|
||||
Logger<MainWindow> logger = new Logger<MainWindow>(LoggingHelper.Factory);
|
||||
|
||||
Reference in New Issue
Block a user