using Serilog;
using Serilog.Formatting.Display;
using Serilog.Sinks.LogEmAll;
namespace PatchEmAll_CLI
{
///
/// The Main Program Class.
///
class Program
{
///
/// The Main entry point for the program.
///
static void Main(string[] args)
{
// Configure the Logger.
ConfigureSerilog();
// Create a new program object.
PatchEmAll.PatchEmAll pea = new PatchEmAll.PatchEmAll();
// Set the title.
pea.UpdateTitle();
// Print the version.
pea.PrintVersion();
// Load the default options passed from the default options file.
pea.LoadOptionsFromFile();
// Load the default options passed from the command line arguments.
pea.LoadOptionsFromCLI(args);
// Process the command switch.
pea.ProcessCommandSwitch();
// Output the log to a text file.
pea.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();
}
}
}