private static void ConfigureLogging(Arguments arguments, ILog log)
        {
            if (arguments.Output == OutputType.BuildServer || arguments.LogFilePath == "console" || arguments.Init)
            {
                log.AddLogAppender(new ConsoleAppender());
            }

            if (arguments.LogFilePath != null && arguments.LogFilePath != "console")
            {
                log.AddLogAppender(new FileAppender(arguments.LogFilePath));
            }
        }
Exemple #2
0
        private static void ConfigureLogging(GitVersionOptions gitVersionOptions, ILog log)
        {
            if (gitVersionOptions.Output.Contains(OutputType.BuildServer) || gitVersionOptions.LogFilePath == "console" || gitVersionOptions.Init)
            {
                log.AddLogAppender(new ConsoleAppender());
            }

            if (gitVersionOptions.LogFilePath != null && gitVersionOptions.LogFilePath != "console")
            {
                log.AddLogAppender(new FileAppender(gitVersionOptions.LogFilePath));
            }
        }
        public async Task Execute(Arguments arguments, CancellationToken cancellationToken)
        {
            if (arguments is null)
            {
                _helpWriter.Write();
                throw new FatalException("Arguments is null.");
            }

            if (arguments.IsVersion)
            {
                _versionWriter.Write(Assembly.GetExecutingAssembly());
                return;
            }

            if (arguments.IsHelp)
            {
                _helpWriter.Write();
                return;
            }

            // Configure Logging
            _log.AddLogAppender(new ConsoleAppender());

            if (arguments.LogFilePath != null)
            {
                _log.AddLogAppender(new FileAppender(arguments.LogFilePath));
            }

            if (!File.Exists(arguments.DacPacFilePath))
            {
                throw new FatalException($"DacPac FilePath '{arguments.DacPacFilePath}' does not exist!", true);
            }

            // Continue with Deployment
            _log.Info("Using DacPac: {0}", arguments.DacPacFilePath);

            if (arguments.Threads == 0)
            {
                _log.Debug("Threads value was 0, so using default value of 1.");
                arguments.Threads = 1;
            }

            await _execCommand.Execute(cancellationToken);
        }