Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions seqcli.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 29 additions & 16 deletions src/SeqCli/Cli/Commands/SearchCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,36 @@ protected override async Task<int> 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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/SeqCli/Cli/Features/OutputFormatFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SystemConsoleTheme.Literate variant doesn't work well in any terminal on my Linux box; using ANSI theming on macOS and Windows is a better bet.

static readonly TemplateTheme DefaultTemplateTheme = TemplateTheme.Code;

bool _json, _noColor, _forceColor;

Expand Down
2 changes: 1 addition & 1 deletion test/SeqCli.EndToEnd/Dashboard/RenderTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down