Integrate NLog for centralized logging, replacing Console calls across CLI tasks. Add LoggingService helper for setup and logger retrieval. Update project dependencies.

This commit is contained in:
Andre Beging
2025-12-12 09:29:31 +01:00
parent c9a56abe8b
commit 516fceb1dc
7 changed files with 102 additions and 28 deletions

View File

@@ -4,16 +4,21 @@ using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using FsToolbox.Cli;
using FsToolbox.Cli.Helper;
using NLog;
// See https://aka.ms/new-console-template for more information
LoggingService.Initialize();
var logger = LoggingService.GetLogger("FsToolbox.Cli.Program");
using var httpClient = new HttpClient();
// Show menu for the user to choose from the two tasks
Console.WriteLine("Choose a task to execute:");
Console.WriteLine("1. Check Aldi Memberships");
Console.WriteLine("2. Confirm all Unconfirmed Pickups for Lindenberg");
Console.Write("Enter the number of the task to execute (or any other key to exit): ");
logger.Info("Choose a task to execute:");
logger.Info("1. Check Aldi Memberships");
logger.Info("2. Confirm all Unconfirmed Pickups for Lindenberg");
logger.Info("Enter the number of the task to execute (or any other key to exit): ");
var choice = Console.ReadLine();
switch (choice)
@@ -25,6 +30,6 @@ switch (choice)
await CustomTasks.ConfirmUnconfirmedPickupsLindenbergAsync(httpClient);
break;
default:
Console.WriteLine("Exiting...");
logger.Info("Exiting...");
break;
}