diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-06 15:19:36 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-07 10:00:17 +0100 |
commit | 1174c013226e560820f44a637b9744d9606b414a (patch) | |
tree | b6984fe64dd22bc9b2c6ef31af04a0cdc67a0099 /src/buildtool/common/cli.hpp | |
parent | afc83eda066cf242ea29161e67060720b73b5908 (diff) | |
download | justbuild-1174c013226e560820f44a637b9744d9606b414a.tar.gz |
just: Allow multiple log files
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r-- | src/buildtool/common/cli.hpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 0a8fcf56..6592a02f 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -42,7 +42,7 @@ struct CommonArguments { }; struct LogArguments { - std::optional<std::filesystem::path> log_file{}; + std::vector<std::filesystem::path> log_files{}; LogLevel log_limit{kDefaultLogLevel}; bool plain_log{false}; }; @@ -151,9 +151,15 @@ static inline auto SetupCommonArguments( static inline auto SetupLogArguments( gsl::not_null<CLI::App*> const& app, gsl::not_null<LogArguments*> const& clargs) { - app->add_option( - "-f,--log-file", clargs->log_file, "Path to local log file.") - ->type_name("PATH"); + app->add_option_function<std::string>( + "-f,--log-file", + [clargs](auto const& log_file_) { + clargs->log_files.emplace_back(log_file_); + }, + "Path to local log file.") + ->type_name("PATH") + ->trigger_on_parse(); // run callback on all instances while parsing, + // not after all parsing is done app->add_option_function<std::underlying_type_t<LogLevel>>( "--log-limit", [clargs](auto const& limit) { |