using Serilog; using Serilog.Formatting.Display; using Serilog.Sinks.LogEmAll; namespace Files2Folders2Files_CLI { /// /// The Main Program Class. /// class Program { /// /// The main entry point for the application. /// /// static void Main(string[] args) { // Configure the Logger. ConfigureSerilog(); // Create a new program object. Files2Folders2Files.Files2Folders2Files f2f2f = new Files2Folders2Files.Files2Folders2Files(); // Set the title. f2f2f.UpdateTitle(); // Print the version. f2f2f.PrintVersion(); // Load the default options passed from the default options file. f2f2f.LoadOptionsFromFile(); // Load the default options passed from the command line arguments. f2f2f.LoadOptionsFromCLI(args); // Process the command switch. f2f2f.ProcessCommandSwitch(); // Output the log to a text file. f2f2f.SaveLogToFile(); } /// /// Configure the logger. /// public static void ConfigureSerilog() { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Console(outputTemplate: "{Level:u4}: {Message:lj}{NewLine}{Exception}") .WriteToListString(new MessageTemplateTextFormatter("{Level:u4}: {Message:lj}{Exception}")) .CreateLogger(); } } }