public override void Log(ILogMessage message) { if ((int)message.Level >= (int)VerbosityLevel) { CmdUtils.LogToConsole(message.Level, message.Message); } }
public static int Main(string[] args) { var logLevel = LogLevel.Information; if (CmdUtils.IsDebugModeEnabled()) { logLevel = LogLevel.Debug; } var log = new ConsoleLogger(logLevel); var task = MainCore(args, log); return(task.Result); }
public static Task <int> MainCore(string[] args, HttpSource httpSource, ILogger log) { CmdUtils.LaunchDebuggerIfSet(ref args, log); var app = new CommandLineApplication() { Name = "NuGet.CatalogValidator", FullName = "nuget mirror" }; app.HelpOption(Constants.HelpOption); app.VersionOption("--version", (new NuGetVersion(CmdUtils.GetAssemblyVersion())).ToNormalizedString()); app.Description = "Validate a nuget v3 feed."; Configure(); ValidateCommand.Register(app, httpSource, log); app.OnExecute(() => { app.ShowHelp(); return(1); }); var exitCode = 1; try { exitCode = app.Execute(args); } catch (CommandParsingException ex) { ex.Command.ShowHelp(); } catch (Exception ex) { ExceptionUtils.LogException(ex, log); } return(Task.FromResult(exitCode)); }