using Serilog; using System.CommandLine; namespace DownloadManager; class Program { static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Console() .CreateLogger(); Log.Information("Starting DownloadManager"); configuration config = new(); Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Console() .WriteTo.File($"{config.logDirectory}/log.txt", rollingInterval: RollingInterval.Day) .CreateLogger(); Log.Information("Configuration created, Logger re-created with file logging."); RootCommand root = new RootCommand("Download Manager"); root.SetHandler(() => { run(config); }); root.Invoke(args); } /* Handler method for root command */ static void run(configuration config) { RuleManager ruleManager = new(ref config); ruleManager.ApplyRules(); } }