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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user