diff --git a/src/SeqCli/Cli/Features/OutputFormatFeature.cs b/src/SeqCli/Cli/Features/OutputFormatFeature.cs index 297332db..267b53a5 100644 --- a/src/SeqCli/Cli/Features/OutputFormatFeature.cs +++ b/src/SeqCli/Cli/Features/OutputFormatFeature.cs @@ -13,6 +13,7 @@ // limitations under the License. using SeqCli.Config; +using SeqCli.Output; using Serilog; using Serilog.Core; using Serilog.Events; @@ -43,7 +44,8 @@ public override void Enable(OptionSet options) public Logger CreateOutputLogger() { var outputConfiguration = new LoggerConfiguration() - .MinimumLevel.Is(LevelAlias.Minimum); + .MinimumLevel.Is(LevelAlias.Minimum) + .Enrich.With(); if (_json) outputConfiguration.WriteTo.Console(new CompactJsonFormatter()); diff --git a/src/SeqCli/Output/RedundantEventTypeRemovalEnricher.cs b/src/SeqCli/Output/RedundantEventTypeRemovalEnricher.cs new file mode 100644 index 00000000..fbd89010 --- /dev/null +++ b/src/SeqCli/Output/RedundantEventTypeRemovalEnricher.cs @@ -0,0 +1,27 @@ +// Copyright 2018 Datalust Pty Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Serilog.Core; +using Serilog.Events; + +namespace SeqCli.Output +{ + public class RedundantEventTypeRemovalEnricher : ILogEventEnricher + { + public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) + { + logEvent.RemovePropertyIfPresent("@i"); + } + } +} diff --git a/src/SeqCli/Program.cs b/src/SeqCli/Program.cs index dd8c309d..668db97c 100644 --- a/src/SeqCli/Program.cs +++ b/src/SeqCli/Program.cs @@ -28,7 +28,7 @@ static async Task Main(string[] args) Log.Logger = new LoggerConfiguration() .MinimumLevel.Error() .WriteTo.Console( - outputTemplate: "{Message:lj}{NewLine}", + outputTemplate: "{Message:lj}{NewLine}{Exception}", standardErrorFromLevel: LevelAlias.Minimum) .CreateLogger();