예제 #1
0
    public async ValueTask ExecuteAsync(IConsole console)
    {
        // Must happen first because everything can use the logger.
        _loggingLevelSwitch.MinimumLevel = Debug ? LogEventLevel.Debug : LogEventLevel.Information;

        // Has to happen right after logging because stuff below may use settings.
        _settingsPersister.Load();

        SetupHttp();
        _repoUpdater.UpdateRepo();

        try
        {
            await Process();
        }
        catch (YamlException e)
        {
            var inner = e.InnerException;
            if (inner == null)
            {
                throw;
            }

            _log.Error("Found Unrecognized YAML Property: {ErrorMsg}", inner.Message);
            _log.Error("Please remove the property quoted in the above message from your YAML file");
            throw new CommandException("Exiting due to invalid configuration");
        }
        catch (Exception e) when(e is not CommandException)
        {
            _log.Error(e, "Unrecoverable Exception");
            ExitDueToFailure();
        }
        finally
        {
            _logJanitor.DeleteOldestLogFiles(20);
        }
    }
예제 #2
0
 private void LoadSettings()
 {
     _settingsPersister.Load();
 }