From 0370a050bcb8df8de8b3f1c61c540d266cd3e2e8 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 19 Feb 2025 17:02:40 +0100 Subject: [PATCH 1/3] Add shared Elastic.Documentation.Tooling libraries for all CLI binaries --- .../DocumentationTooling.cs | 65 +++++++++++++++++++ .../Elastic.Documentation.Tooling.csproj | 17 +++++ .../Filters/CatchExceptionFilter.cs | 31 +++++++++ .../Filters/StopwatchFilter.cs | 36 +++------- .../Logging/CondensedConsoleLogger.cs | 57 ++++++++++++++++ Elastic.Documentation.Tooling/README.md | 5 ++ docs-builder.sln | 7 ++ .../DocumentationGenerator.cs | 2 +- src/Elastic.Markdown/IO/DocumentationSet.cs | 4 ++ src/docs-assembler/Cli/Filters.cs | 52 --------------- src/docs-assembler/Program.cs | 22 ++----- src/docs-assembler/docs-assembler.csproj | 7 +- src/docs-builder/Cli/Commands.cs | 6 ++ .../Console/ErrataFileSourceRepository.cs | 24 ++++--- src/docs-builder/Program.cs | 22 ++----- src/docs-builder/docs-builder.csproj | 7 +- 16 files changed, 232 insertions(+), 132 deletions(-) create mode 100644 Elastic.Documentation.Tooling/DocumentationTooling.cs create mode 100644 Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj create mode 100644 Elastic.Documentation.Tooling/Filters/CatchExceptionFilter.cs rename src/docs-builder/Cli/Filters.cs => Elastic.Documentation.Tooling/Filters/StopwatchFilter.cs (55%) create mode 100644 Elastic.Documentation.Tooling/Logging/CondensedConsoleLogger.cs create mode 100644 Elastic.Documentation.Tooling/README.md delete mode 100644 src/docs-assembler/Cli/Filters.cs diff --git a/Elastic.Documentation.Tooling/DocumentationTooling.cs b/Elastic.Documentation.Tooling/DocumentationTooling.cs new file mode 100644 index 000000000..c282c7ee9 --- /dev/null +++ b/Elastic.Documentation.Tooling/DocumentationTooling.cs @@ -0,0 +1,65 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +using Actions.Core.Extensions; +using Elastic.Documentation.Tooling.Logging; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Console; + +namespace Elastic.Documentation.Tooling; + +public static class DocumentationTooling +{ + public static ServiceProvider CreateServiceProvider(ref string[] args, Action? configure = null) + { + var defaultLogLevel = LogLevel.Information; + ProcessCommandLineArguments(ref args, ref defaultLogLevel); + + var services = new ServiceCollection() + .AddGitHubActionsCore(); + _ = services.AddLogging(x => x + .ClearProviders() + .SetMinimumLevel(defaultLogLevel) + .AddConsole(c => c.FormatterName = "condensed") + .AddConsoleFormatter() + ); + + + configure?.Invoke(services); + + return services.BuildServiceProvider(); + } + + private static void ProcessCommandLineArguments(ref string[] args, ref LogLevel defaultLogLevel) + { + var newArgs = new List(); + for (var i = 0; i < args.Length; i++) + { + if (args[i] == "--log-level") + { + if (args.Length > i + 1) + defaultLogLevel = GetLogLevel(args[i + 1]); + + i++; + } + else + newArgs.Add(args[i]); + } + + args = [.. newArgs]; + } + + private static LogLevel GetLogLevel(string? logLevel) => logLevel switch + { + "trace" => LogLevel.Trace, + "debug" => LogLevel.Debug, + "information" => LogLevel.Information, + "info" => LogLevel.Information, + "warning" => LogLevel.Warning, + "error" => LogLevel.Error, + "critical" => LogLevel.Critical, + _ => LogLevel.Information + }; +} diff --git a/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj b/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj new file mode 100644 index 000000000..6287544a0 --- /dev/null +++ b/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + diff --git a/Elastic.Documentation.Tooling/Filters/CatchExceptionFilter.cs b/Elastic.Documentation.Tooling/Filters/CatchExceptionFilter.cs new file mode 100644 index 000000000..0f8fb4c10 --- /dev/null +++ b/Elastic.Documentation.Tooling/Filters/CatchExceptionFilter.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +using ConsoleAppFramework; +using Microsoft.Extensions.Logging; + +namespace Elastic.Documentation.Tooling.Filters; + +public sealed class CatchExceptionFilter(ConsoleAppFilter next, ILogger logger) + : ConsoleAppFilter(next) +{ + public override async Task InvokeAsync(ConsoleAppContext context, Cancel cancellationToken) + { + try + { + await Next.InvokeAsync(context, cancellationToken); + } + catch (Exception ex) + { + if (ex is OperationCanceledException) + { + logger.LogInformation("Cancellation requested, exiting."); + return; + } + + throw; + + } + } +} diff --git a/src/docs-builder/Cli/Filters.cs b/Elastic.Documentation.Tooling/Filters/StopwatchFilter.cs similarity index 55% rename from src/docs-builder/Cli/Filters.cs rename to Elastic.Documentation.Tooling/Filters/StopwatchFilter.cs index 0f3de93ca..b9be98d05 100644 --- a/src/docs-builder/Cli/Filters.cs +++ b/Elastic.Documentation.Tooling/Filters/StopwatchFilter.cs @@ -1,51 +1,31 @@ // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information + using System.Diagnostics; using ConsoleAppFramework; +using Microsoft.Extensions.Logging; -namespace Documentation.Builder.Cli; +namespace Elastic.Documentation.Tooling.Filters; -internal sealed class StopwatchFilter(ConsoleAppFilter next) : ConsoleAppFilter(next) +public class StopwatchFilter(ConsoleAppFilter next, ILogger logger) : ConsoleAppFilter(next) { - public override async Task InvokeAsync(ConsoleAppContext context, Cancel ctx) + public override async Task InvokeAsync(ConsoleAppContext context, Cancel cancellationToken) { var isHelpOrVersion = context.Arguments.Any(a => a is "--help" or "-h" or "--version"); var name = string.IsNullOrWhiteSpace(context.CommandName) ? "generate" : context.CommandName; var startTime = Stopwatch.GetTimestamp(); if (!isHelpOrVersion) - ConsoleApp.Log($"{name} :: Starting..."); + logger.LogInformation("{Name} :: Starting...", name); try { - await Next.InvokeAsync(context, ctx); + await Next.InvokeAsync(context, cancellationToken); } finally { var endTime = Stopwatch.GetElapsedTime(startTime); if (!isHelpOrVersion) - ConsoleApp.Log($"{name} :: Finished in '{endTime}"); - } - } -} - -internal sealed class CatchExceptionFilter(ConsoleAppFilter next) : ConsoleAppFilter(next) -{ - public override async Task InvokeAsync(ConsoleAppContext context, Cancel cancellationToken) - { - try - { - await Next.InvokeAsync(context, cancellationToken); - } - catch (Exception ex) - { - if (ex is OperationCanceledException) - { - ConsoleApp.Log("Cancellation requested, exiting."); - return; - } - - throw; - + logger.LogInformation("{Name} :: Finished in '{EndTime}'", name, endTime); } } } diff --git a/Elastic.Documentation.Tooling/Logging/CondensedConsoleLogger.cs b/Elastic.Documentation.Tooling/Logging/CondensedConsoleLogger.cs new file mode 100644 index 000000000..852087708 --- /dev/null +++ b/Elastic.Documentation.Tooling/Logging/CondensedConsoleLogger.cs @@ -0,0 +1,57 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Logging.Console; +using static Crayon.Output; + +namespace Elastic.Documentation.Tooling.Logging; + +public class CondensedConsoleFormatter() : ConsoleFormatter("condensed") +{ + public override void Write( + in LogEntry logEntry, IExternalScopeProvider? scopeProvider, TextWriter textWriter + ) + { + var now = DateTime.UtcNow; + var message = logEntry.Formatter.Invoke(logEntry.State, logEntry.Exception); + + var logLevel = GetLogLevel(logEntry.LogLevel); + var categoryName = logEntry.Category; + + var nowString = + Environment.UserInteractive + ? "" + : now.ToString("[yyyy-MM-ddTHH:mm:ss.fffZ] ", System.Globalization.CultureInfo.InvariantCulture); + + textWriter.WriteLine($"{nowString}{logLevel}::{ShortCategoryName(categoryName)}:: {message}"); + } + + private static string GetLogLevel(LogLevel logLevel) => logLevel switch + { + LogLevel.Trace => "trace", + LogLevel.Debug => "debug", + LogLevel.Information => Blue().Bold().Text("info "), + LogLevel.Warning => Yellow().Bold().Text("warn "), + LogLevel.Error => Red().Bold().Text("error"), + LogLevel.Critical => Red().Bold().Text("fail "), + LogLevel.None => " ", + _ => "???" + }; + + private static string ShortCategoryName(string category) + { + var tokens = category.Split('.', StringSplitOptions.RemoveEmptyEntries); + var s = string.Join(".", tokens.Take(tokens.Length - 1).Select(t => t.ToLowerInvariant().First()).ToArray()); + if (s.Length > 0) + s += "."; + + var maxLength = 22 - s.Length; + var last = tokens.Last(); + var start = Math.Max(0, last.Length - maxLength); + s += last[start..]; + return Dim().Text(s.PadRight(22)); + } +} diff --git a/Elastic.Documentation.Tooling/README.md b/Elastic.Documentation.Tooling/README.md new file mode 100644 index 000000000..ee30cacf4 --- /dev/null +++ b/Elastic.Documentation.Tooling/README.md @@ -0,0 +1,5 @@ +# Elastic.Documentation.Tooling + +This is a shared library for our command line tooling. + +Ensures we share the same logging infrastructure and command line helpers \ No newline at end of file diff --git a/docs-builder.sln b/docs-builder.sln index 4f2a8e11a..e04bb687d 100644 --- a/docs-builder.sln +++ b/docs-builder.sln @@ -53,6 +53,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assembler", "assembler", "{ actions\assembler\action.yml = actions\assembler\action.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Tooling", "Elastic.Documentation.Tooling\Elastic.Documentation.Tooling.csproj", "{4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -95,6 +97,10 @@ Global {7D36DDDA-9E0B-4D2C-8033-5D62FF8B6166}.Debug|Any CPU.Build.0 = Debug|Any CPU {7D36DDDA-9E0B-4D2C-8033-5D62FF8B6166}.Release|Any CPU.ActiveCfg = Release|Any CPU {7D36DDDA-9E0B-4D2C-8033-5D62FF8B6166}.Release|Any CPU.Build.0 = Release|Any CPU + {4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {4D198E25-C211-41DC-9E84-B15E89BD7048} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} @@ -106,5 +112,6 @@ Global {018F959E-824B-4664-B345-066784478D24} = {67B576EE-02FA-4F9B-94BC-3630BC09ECE5} {7D36DDDA-9E0B-4D2C-8033-5D62FF8B6166} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} {CFEE9FAD-9E0C-4C0E-A0C2-B97D594C14B5} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} + {4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} EndGlobalSection EndGlobal diff --git a/src/Elastic.Markdown/DocumentationGenerator.cs b/src/Elastic.Markdown/DocumentationGenerator.cs index 1ea016b07..46fe8516f 100644 --- a/src/Elastic.Markdown/DocumentationGenerator.cs +++ b/src/Elastic.Markdown/DocumentationGenerator.cs @@ -144,7 +144,7 @@ private async Task ExtractEmbeddedStaticResources(Cancel ctx) outputFile.Directory.Create(); await using var stream = outputFile.OpenWrite(); await resourceStream.CopyToAsync(stream, ctx); - _logger.LogInformation("Copied static embedded resource {Path}", path); + _logger.LogDebug("Copied static embedded resource {Path}", path); } } diff --git a/src/Elastic.Markdown/IO/DocumentationSet.cs b/src/Elastic.Markdown/IO/DocumentationSet.cs index 8e9c90c4d..5150145f2 100644 --- a/src/Elastic.Markdown/IO/DocumentationSet.cs +++ b/src/Elastic.Markdown/IO/DocumentationSet.cs @@ -51,6 +51,10 @@ public DocumentationSet(BuildContext context, ILoggerFactory logger, ICrossLinkR Files = [.. context.ReadFileSystem.Directory .EnumerateFiles(SourcePath.FullName, "*.*", SearchOption.AllDirectories) .Select(f => context.ReadFileSystem.FileInfo.New(f)) + .Where(f => !f.Attributes.HasFlag(FileAttributes.Hidden) && !f.Attributes.HasFlag(FileAttributes.System)) + .Where(f => !f.Directory!.Attributes.HasFlag(FileAttributes.Hidden) && !f.Directory!.Attributes.HasFlag(FileAttributes.System)) + // skip hidden folders + .Where(f => !Path.GetRelativePath(SourcePath.FullName, f.FullName).StartsWith('.')) .Select(file => file.Extension switch { ".jpg" => new ImageFile(file, SourcePath, "image/jpeg"), diff --git a/src/docs-assembler/Cli/Filters.cs b/src/docs-assembler/Cli/Filters.cs deleted file mode 100644 index 2d5427320..000000000 --- a/src/docs-assembler/Cli/Filters.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Diagnostics; -using ConsoleAppFramework; - -namespace Documentation.Assembler.Cli; - -internal sealed class StopwatchFilter(ConsoleAppFilter next) : ConsoleAppFilter(next) -{ - public override async Task InvokeAsync(ConsoleAppContext context, Cancel ctx) - { - var isHelpOrVersion = context.Arguments.Any(a => a is "--help" or "-h" or "--version"); - var name = string.IsNullOrWhiteSpace(context.CommandName) ? "generate" : context.CommandName; - var startTime = Stopwatch.GetTimestamp(); - if (!isHelpOrVersion) - ConsoleApp.Log($"{name} :: Starting..."); - try - { - await Next.InvokeAsync(context, ctx); - } - finally - { - var endTime = Stopwatch.GetElapsedTime(startTime); - if (!isHelpOrVersion) - ConsoleApp.Log($"{name} :: Finished in '{endTime}"); - } - } -} - -internal sealed class CatchExceptionFilter(ConsoleAppFilter next) : ConsoleAppFilter(next) -{ - public override async Task InvokeAsync(ConsoleAppContext context, CancellationToken cancellationToken) - { - try - { - await Next.InvokeAsync(context, cancellationToken); - } - catch (Exception ex) - { - if (ex is OperationCanceledException) - { - ConsoleApp.Log("Cancellation requested, exiting."); - return; - } - - throw; - - } - } -} diff --git a/src/docs-assembler/Program.cs b/src/docs-assembler/Program.cs index 021cd6315..e0fc87bca 100644 --- a/src/docs-assembler/Program.cs +++ b/src/docs-assembler/Program.cs @@ -2,31 +2,19 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information -using Actions.Core.Extensions; using Actions.Core.Services; using ConsoleAppFramework; using Documentation.Assembler.Cli; +using Elastic.Documentation.Tooling; +using Elastic.Documentation.Tooling.Filters; using Elastic.Markdown.Diagnostics; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -var services = new ServiceCollection(); -services.AddGitHubActionsCore(); -services.AddLogging(x => x - .ClearProviders() - .SetMinimumLevel(LogLevel.Information) - .AddSimpleConsole(c => - { - c.SingleLine = true; - c.IncludeScopes = true; - c.UseUtcTimestamp = true; - c.TimestampFormat = Environment.UserInteractive ? ":: " : "[yyyy-MM-ddTHH:mm:ss] "; - }) +await using var serviceProvider = DocumentationTooling.CreateServiceProvider(ref args, services => services + .AddSingleton() + .AddSingleton() ); -services.AddSingleton(); -services.AddSingleton(); -await using var serviceProvider = services.BuildServiceProvider(); ConsoleApp.ServiceProvider = serviceProvider; var app = ConsoleApp.Create(); diff --git a/src/docs-assembler/docs-assembler.csproj b/src/docs-assembler/docs-assembler.csproj index 2c29e96ed..cca53fbb6 100644 --- a/src/docs-assembler/docs-assembler.csproj +++ b/src/docs-assembler/docs-assembler.csproj @@ -17,16 +17,15 @@ - - all + + runtime; build; native; contentfiles; analyzers; buildtransitive - - + diff --git a/src/docs-builder/Cli/Commands.cs b/src/docs-builder/Cli/Commands.cs index 5c32681e4..a80052343 100644 --- a/src/docs-builder/Cli/Commands.cs +++ b/src/docs-builder/Cli/Commands.cs @@ -6,6 +6,7 @@ using ConsoleAppFramework; using Documentation.Builder.Diagnostics.Console; using Documentation.Builder.Http; +using Elastic.Documentation.Tooling.Filters; using Elastic.Markdown; using Elastic.Markdown.IO; using Elastic.Markdown.Refactor; @@ -45,6 +46,8 @@ public async Task Serve(string? path = null, int port = 3000, Cancel ctx = defau /// /// Converts a source markdown folder or file to an output folder + /// global options: + /// --log-level level /// /// -p, Defaults to the`{pwd}/docs` folder /// -o, Defaults to `.artifacts/html` @@ -124,6 +127,9 @@ public async Task GenerateDefault( /// Dry run the move operation /// [Command("mv")] + [ConsoleAppFilter] + [ConsoleAppFilter] + [ConsoleAppFilter] public async Task Move( [Argument] string source, [Argument] string target, diff --git a/src/docs-builder/Diagnostics/Console/ErrataFileSourceRepository.cs b/src/docs-builder/Diagnostics/Console/ErrataFileSourceRepository.cs index b9d874353..07121aec9 100644 --- a/src/docs-builder/Diagnostics/Console/ErrataFileSourceRepository.cs +++ b/src/docs-builder/Diagnostics/Console/ErrataFileSourceRepository.cs @@ -52,17 +52,25 @@ public void WriteDiagnosticsToConsole(IReadOnlyCollection errors, IR _ = report.AddDiagnostic(d); } - // Render the report - report.Render(AnsiConsole.Console); - var totalErrorCount = errors.Count + warnings.Count; - if (limitted.Length >= totalErrorCount) - return; AnsiConsole.WriteLine(); - AnsiConsole.WriteLine(); - AnsiConsole.Write(new Markup($"Displayed first [bold]{limitted.Length}[/] error/warnings out of [bold]{totalErrorCount}[/]")); + if (totalErrorCount > 0) + { + AnsiConsole.Write(new Markup($" [bold]The following errors and warnings were found in the documentation[/]")); + AnsiConsole.WriteLine(); + AnsiConsole.WriteLine(); + // Render the report + report.Render(AnsiConsole.Console); - AnsiConsole.WriteLine(); + AnsiConsole.WriteLine(); + AnsiConsole.WriteLine(); + + if (limitted.Length <= totalErrorCount) + AnsiConsole.Write(new Markup($" [bold]Only shown the first [yellow]{limitted.Length}[/] diagnostics out of [yellow]{totalErrorCount}[/][/]")); + + AnsiConsole.WriteLine(); + + } } } diff --git a/src/docs-builder/Program.cs b/src/docs-builder/Program.cs index 021239ec7..ee39ab1c3 100644 --- a/src/docs-builder/Program.cs +++ b/src/docs-builder/Program.cs @@ -2,30 +2,16 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information -using Actions.Core.Extensions; using ConsoleAppFramework; using Documentation.Builder.Cli; +using Elastic.Documentation.Tooling; using Elastic.Markdown.Diagnostics; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -var services = new ServiceCollection(); -services.AddGitHubActionsCore(); -services.AddLogging(x => x - .ClearProviders() - .SetMinimumLevel(LogLevel.Information) - .AddSimpleConsole(c => - { - c.SingleLine = true; - c.IncludeScopes = true; - c.UseUtcTimestamp = true; - c.TimestampFormat = Environment.UserInteractive ? ":: " : "[yyyy-MM-ddTHH:mm:ss] "; - }) +await using var serviceProvider = DocumentationTooling.CreateServiceProvider(ref args, services => services + .AddSingleton() + .AddSingleton() ); -services.AddSingleton(); -services.AddSingleton(); - -await using var serviceProvider = services.BuildServiceProvider(); ConsoleApp.ServiceProvider = serviceProvider; var app = ConsoleApp.Create(); diff --git a/src/docs-builder/docs-builder.csproj b/src/docs-builder/docs-builder.csproj index 16fa62385..dde666ae1 100644 --- a/src/docs-builder/docs-builder.csproj +++ b/src/docs-builder/docs-builder.csproj @@ -19,17 +19,16 @@ - - all + + runtime; build; native; contentfiles; analyzers; buildtransitive - - + From df904d891e79bf5ef6d51582591e155ddf234e88 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 19 Feb 2025 17:04:59 +0100 Subject: [PATCH 2/3] remove BOM --- Elastic.Documentation.Tooling/DocumentationTooling.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Elastic.Documentation.Tooling/DocumentationTooling.cs b/Elastic.Documentation.Tooling/DocumentationTooling.cs index c282c7ee9..f4e4040c5 100644 --- a/Elastic.Documentation.Tooling/DocumentationTooling.cs +++ b/Elastic.Documentation.Tooling/DocumentationTooling.cs @@ -1,4 +1,4 @@ -// Licensed to Elasticsearch B.V under one or more agreements. +// Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information From e1dc5fa357954eaab462b2742605ac9b37d3d157 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 19 Feb 2025 17:17:36 +0100 Subject: [PATCH 3/3] register console formatter without options --- Elastic.Documentation.Tooling/DocumentationTooling.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Elastic.Documentation.Tooling/DocumentationTooling.cs b/Elastic.Documentation.Tooling/DocumentationTooling.cs index f4e4040c5..7b956b8b9 100644 --- a/Elastic.Documentation.Tooling/DocumentationTooling.cs +++ b/Elastic.Documentation.Tooling/DocumentationTooling.cs @@ -5,6 +5,7 @@ using Actions.Core.Extensions; using Elastic.Documentation.Tooling.Logging; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; @@ -19,11 +20,11 @@ public static ServiceProvider CreateServiceProvider(ref string[] args, Action()); _ = services.AddLogging(x => x .ClearProviders() .SetMinimumLevel(defaultLogLevel) .AddConsole(c => c.FormatterName = "condensed") - .AddConsoleFormatter() );