diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-08-02 17:57:45 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-08-05 15:41:00 +0200 |
commit | 6ac0e6960a3300401340191a47c680ea3432e8f1 (patch) | |
tree | 896db295d0ab9929f06b6587b9e7befb5d436beb | |
parent | 7f6345f5e31233a79845298ff881c5caaf06f803 (diff) | |
download | justbuild-6ac0e6960a3300401340191a47c680ea3432e8f1.tar.gz |
Make ANSI escape sequences optional
-rw-r--r-- | src/buildtool/common/cli.hpp | 4 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 46af6598..f0875aaa 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -30,6 +30,7 @@ struct CommonArguments { struct LogArguments { std::optional<std::filesystem::path> log_file{}; LogLevel log_limit{kDefaultLogLevel}; + bool plain_log{false}; }; /// \brief Arguments required for analysing targets. @@ -148,6 +149,9 @@ static inline auto SetupLogArguments( kLastLogLevel, kDefaultLogLevel)) ->type_name("NUM"); + app->add_flag("--plain-log", + clargs->plain_log, + "Do not use ANSI escape sequences to highlight messages."); } static inline auto SetupAnalysisArguments( diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 5f40f698..7b432c16 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -220,6 +220,7 @@ void SetupDefaultLogging() { void SetupLogging(LogArguments const& clargs) { LogConfig::SetLogLimit(clargs.log_limit); + LogConfig::SetSinks({LogSinkCmdLine::CreateFactory(not clargs.plain_log)}); if (clargs.log_file) { LogConfig::AddSink(LogSinkFile::CreateFactory( *clargs.log_file, LogSinkFile::Mode::Overwrite)); |