예제 #1
0
        private static void startCommand <TRunOptions>(CLICommand <TRunOptions> command)
        {
            var logger = initializeLogger(command);

            if (command.LogCommandName)
            {
                logger.AddInfo($"Starting {command.Name.ToLower()} run");
            }

            logger.AddDebug($"Arguments:\n{command}");
            ApplicationStartup.Start();
            var runner = IoC.Resolve <IBatchRunner <TRunOptions> >();

            try
            {
                runner.RunBatchAsync(command.ToRunOptions()).Wait();
            }
            catch (Exception e)
            {
                logger.AddException(e);
                _valid = false;
            }

            if (command.LogCommandName)
            {
                logger.AddInfo($"{command.Name} run finished");
            }
        }
예제 #2
0
        private static void startCommand <TRunOptions>(CLICommand <TRunOptions> command)
        {
            var(logger, loggerFactory) = initializeLogger(command);

            logger.AddInfo($"Starting {command.Name.ToLower()}");
            logger.AddDebug($"Arguments:\n{command}");

            var runner = IoC.Resolve <IBatchRunner <TRunOptions> >();

            using (loggerFactory)
            {
                try
                {
                    runner.RunBatchAsync(command.ToRunOptions()).Wait();
                    logger.AddInfo($"{command.Name} finished");
                }
                catch (Exception e)
                {
                    logger.AddException(e);
                    logger.AddError($"{command.Name} failed");
                    _valid = false;
                }
            }
        }