/// <summary> /// The main entry point. /// </summary> /// <param name="args"> /// The args. /// </param> public static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .WriteTo.RollingFile("logs\\log-{Date}.txt") .MinimumLevel.Debug() .CreateLogger(); try { Log.Logger.Information("Started"); if (args.Length < 2) { ShowUsage(); } else { var app = new MainApp(); app.ProgressEvent += AppProgress; app.Run(args); } Environment.ExitCode = 0; Log.Logger.Information("Finished"); } // ReSharper disable once CatchAllClause catch (Exception ex) { Log.Logger.Error(ex, "Error"); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ResetColor(); Environment.ExitCode = 1; } Log.CloseAndFlush(); }
/// <summary> /// The main entry point. /// </summary> /// <param name="args"> /// The args. /// </param> public static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); try { Log.Logger.Information("Started"); var commandLineArgs = ArgsHelper.Parse(args); if (commandLineArgs == null) { ShowUsage(); } else { var app = new MainApp(); app.ProgressEvent += AppProgress; app.Run(commandLineArgs); } Environment.ExitCode = 0; Log.Logger.Information("Finished"); } catch (Exception ex) { Log.Logger.Error(ex, "Error"); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ResetColor(); Environment.ExitCode = 1; } Log.CloseAndFlush(); }