Ejemplo n.º 1
0
        private static int Main(string[] args)
        {
            ProgramBase.CreateLogger();

            try
            {
                var result = Instance.Parse(args);
                return(ProcessArgs(result));
            }
            catch (HelpException e)
            {
                Log.Information(e.Message);
                return(0);
            }
            catch (Exception e)
            {
                if (Log.IsEnabled(LogEventLevel.Debug))
                {
                    Log.Fatal(e, "Fatal exception occurred");
                }
                else
                {
                    Log.Fatal(e.Message);
                }
                if (e is CommandParsingException commandParsingException)
                {
                    Log.Information(commandParsingException.HelpText);
                }

                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }