initial commit

This commit is contained in:
Matthias Heil
2026-04-04 13:30:13 +02:00
commit 6bed9b284c
186 changed files with 10650 additions and 0 deletions
@@ -0,0 +1,73 @@
using System;
using System.Drawing;
using Microsoft.Extensions.Logging;
using AvaloniaNlogNoDI.Extensions;
using Microsoft.Extensions.Configuration;
using Common.Core;
using Common.Core.Extensions;
namespace AvaloniaNlogNoDI.Helpers;
// application-wide DataStoreLogger Factory ... returns a wired up Logger instance
public static class LoggingHelper
{
#region Constructors
static LoggingHelper()
{
// retrieve the log level from 'appsettings'
string value = AppSettings<string>.Current("Logging:LogLevel", "Default") ?? "Information";
Enum.TryParse(value, out LogLevel logLevel);
IConfigurationRoot configuration = new ConfigurationBuilder()
.Initialize()
.Build();
// wire up the loggers
Factory = LoggerFactory.Create(builder => builder
// visual debugging tools
.AddNLogTargetsNoDI(configuration)
// uncomment to use custom logging colors (note: System.Drawing namespace)
//
//.AddNLogTargets(configuration, options =>
//{
// options.Colors[LogLevel.Trace] = new()
// {
// Foreground = Color.White,
// Background = Color.DarkGray
// };
// options.Colors[LogLevel.Debug] = new()
// {
// Foreground = Color.White,
// Background = Color.Gray
// };
// options.Colors[LogLevel.Information] = new()
// {
// Foreground = Color.White,
// Background = Color.DodgerBlue
// };
// options.Colors[LogLevel.Warning] = new()
// {
// Foreground = Color.White,
// Background = Color.Orchid
// };
//})
// set minimum log level from 'appsettings*.json'
.SetMinimumLevel(logLevel));
}
#endregion
#region Properties
public static ILoggerFactory Factory { get; }
#endregion
}