diff --git a/seqcli.sln b/seqcli.sln index 2bc38226..a1b436f8 100644 --- a/seqcli.sln +++ b/seqcli.sln @@ -8,14 +8,8 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{2EA56595-519F-4DD5-9E94-CCC43E3DF624}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore - appveyor.yml = appveyor.yml - Build.ps1 = Build.ps1 LICENSE = LICENSE README.md = README.md - setup.sh = setup.sh - Build.Docker.ps1 = Build.Docker.ps1 - docker-publish.ps1 = docker-publish.ps1 - Setup.ps1 = Setup.ps1 CONTRIBUTING.md = CONTRIBUTING.md ci.global.json = ci.global.json EndProjectSection diff --git a/src/SeqCli/Cli/Commands/SearchCommand.cs b/src/SeqCli/Cli/Commands/SearchCommand.cs index 254c52f8..001bca4d 100644 --- a/src/SeqCli/Cli/Commands/SearchCommand.cs +++ b/src/SeqCli/Cli/Commands/SearchCommand.cs @@ -85,23 +85,36 @@ protected override async Task Run() if (!string.IsNullOrWhiteSpace(_filter)) filter = (await connection.Expressions.ToStrictAsync(_filter)).StrictExpression; - var search = _noWebSockets ? - connection.Events.PagedEnumerateAsync(null, - _signal.Signal, - filter, - _count, - fromDateUtc: _range.Start, - toDateUtc: _range.End, - trace: _trace) : - connection.Events.EnumerateAsync(null, - _signal.Signal, - filter, - _count, - fromDateUtc: _range.Start, - toDateUtc: _range.End, - trace: _trace); + try + { + if (!_noWebSockets) + { + await foreach (var evt in connection.Events.EnumerateAsync(null, + _signal.Signal, + filter, + _count, + fromDateUtc: _range.Start, + toDateUtc: _range.End, + trace: _trace)) + { + output.Write(ToSerilogEvent(evt)); + } + + return 0; + } + } + catch (NotSupportedException nse) + { + Log.Information(nse, "WebSockets not supported; falling back to paged search"); + } - await foreach (var evt in search) + await foreach (var evt in connection.Events.PagedEnumerateAsync(null, + _signal.Signal, + filter, + _count, + fromDateUtc: _range.Start, + toDateUtc: _range.End, + trace: _trace)) { output.Write(ToSerilogEvent(evt)); } diff --git a/src/SeqCli/Cli/Features/OutputFormatFeature.cs b/src/SeqCli/Cli/Features/OutputFormatFeature.cs index bfad25a3..b1017387 100644 --- a/src/SeqCli/Cli/Features/OutputFormatFeature.cs +++ b/src/SeqCli/Cli/Features/OutputFormatFeature.cs @@ -35,9 +35,9 @@ class OutputFormatFeature : CommandFeature public const string DefaultOutputTemplate = "[{Timestamp:o} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"; - public static readonly ConsoleTheme DefaultTheme = SystemConsoleTheme.Literate; public static readonly ConsoleTheme DefaultAnsiTheme = AnsiConsoleTheme.Code; - static readonly TemplateTheme DefaultTemplateTheme = TemplateTheme.Literate; + public static readonly ConsoleTheme DefaultTheme = OperatingSystem.IsWindows() ? SystemConsoleTheme.Literate : DefaultAnsiTheme; + static readonly TemplateTheme DefaultTemplateTheme = TemplateTheme.Code; bool _json, _noColor, _forceColor; diff --git a/test/SeqCli.EndToEnd/Dashboard/RenderTestCase.cs b/test/SeqCli.EndToEnd/Dashboard/RenderTestCase.cs index 23705c45..4c29aff9 100644 --- a/test/SeqCli.EndToEnd/Dashboard/RenderTestCase.cs +++ b/test/SeqCli.EndToEnd/Dashboard/RenderTestCase.cs @@ -19,7 +19,7 @@ public Task ExecuteAsync( var id = runner.LastRunProcess.Output.Split(' ')[0]; - exit = runner.Exec("dashboard render", $"-i {id} -c \"All Events\" --last 1d --by 1h"); + exit = runner.Exec("dashboard render", $"-i {id} -c \"All Events\" --last 1d --by 1h --no-color"); Assert.Equal(0, exit); var lines = new StringReader(runner.LastRunProcess.Output);