From c1bbcdb5cb3ff24163bf1105856dbe614684ee1f Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 9 Apr 2024 11:23:34 +0200 Subject: Add command-line option to restrict log limit on stderr --- src/buildtool/common/cli.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/buildtool/common/cli.hpp') diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index cfe2263a..cf348bff 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -19,8 +19,10 @@ #include #include #include +#include #include #include +#include #include #include "CLI/CLI.hpp" @@ -47,6 +49,7 @@ struct CommonArguments { struct LogArguments { std::vector log_files{}; LogLevel log_limit{kDefaultLogLevel}; + std::optional restrict_stderr_log_limit{}; bool plain_log{false}; bool log_append{false}; }; @@ -249,6 +252,14 @@ static inline auto SetupLogArguments( static_cast(kLastLogLevel), static_cast(kDefaultLogLevel))) ->type_name("NUM"); + app->add_option_function>( + "--restrict-stderr-log-limit", + [clargs](auto const& limit) { + clargs->restrict_stderr_log_limit = ToLogLevel(limit); + }, + "Restrict logging on console to the minimum of the specified " + "--log-limit and this value") + ->type_name("NUM"); app->add_flag("--plain-log", clargs->plain_log, "Do not use ANSI escape sequences to highlight messages."); -- cgit v1.2.3