protected override async Task <int> OnExecuteAuthenticatedAsync(QBittorrentClient client, CommandLineApplication app, IConsole console) { if (!Enum.TryParse(Severity, true, out TorrentLogSeverity severity)) { severity = TorrentLogSeverity.All; } var colorScheme = ColorScheme.Current; var normal = GetColors(colorScheme, "status-normal", colorScheme.Strong); var info = GetColors(colorScheme, "status-info", colorScheme.Strong); var warn = GetColors(colorScheme, "status-warning", colorScheme.Strong); var critical = GetColors(colorScheme, "status-critical", colorScheme.Strong); var timestamp = GetColors(colorScheme, "timestamp", colorScheme.Normal); var message = GetColors(colorScheme, "message", colorScheme.Normal); var log = await client.GetLogAsync(severity, AfterId ?? -1); foreach (var entry in log) { switch (entry.Severity) { case TorrentLogSeverity.Normal: console.WriteColored("[ Normal ]", normal.fg, normal.bg); break; case TorrentLogSeverity.Info: console.WriteColored("[ Info ]", info.fg, info.bg); break; case TorrentLogSeverity.Warning: console.WriteColored("[ Warn ]", warn.fg, warn.bg); break; case TorrentLogSeverity.Critical: console.WriteColored("[Critical]", critical.fg, critical.bg); break; } var time = DateTimeOffset.FromUnixTimeMilliseconds(entry.Timestamp).ToString("s").Replace("T", " "); console.WriteColored($" {entry.Id:D6} {time} ", timestamp.fg, timestamp.bg); console.WriteLineColored(entry.Message, message.fg, message.bg); } return(ExitCodes.Success); }