diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 5 | ||||
-rw-r--r-- | src/other_tools/just_mr/main.cpp | 21 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 30a9032b..2174c331 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -48,6 +48,7 @@ struct MultiRepoLogArguments { std::vector<std::filesystem::path> log_files{}; LogLevel log_limit{kDefaultLogLevel}; bool plain_log{false}; + bool log_append{false}; }; struct MultiRepoSetupArguments { @@ -156,6 +157,10 @@ static inline auto SetupMultiRepoLogArguments( app->add_flag("--plain-log", clargs->plain_log, "Do not use ANSI escape sequences to highlight messages."); + app->add_flag( + "--log-append", + clargs->log_append, + "Append messages to log file instead of overwriting existing."); } static inline void SetupMultiRepoSetupArguments( diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 3888dddb..66fce212 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -185,8 +185,10 @@ void SetupLogging(MultiRepoLogArguments const& clargs) { LogConfig::SetLogLimit(clargs.log_limit); LogConfig::SetSinks({LogSinkCmdLine::CreateFactory(not clargs.plain_log)}); for (auto const& log_file : clargs.log_files) { - LogConfig::AddSink( - LogSinkFile::CreateFactory(log_file, LogSinkFile::Mode::Overwrite)); + LogConfig::AddSink(LogSinkFile::CreateFactory( + log_file, + clargs.log_append ? LogSinkFile::Mode::Append + : LogSinkFile::Mode::Overwrite)); } } @@ -1087,6 +1089,21 @@ void DefaultReachableRepositories( cmd.emplace_back("--local-build-root"); cmd.emplace_back(*arguments.common.just_mr_paths->root); } + // forward logging arguments + if (not arguments.log.log_files.empty()) { + cmd.emplace_back("--log-append"); + for (auto const& log_file : arguments.log.log_files) { + cmd.emplace_back("-f"); + cmd.emplace_back(log_file.string()); + } + } + cmd.emplace_back("--log-limit"); + cmd.emplace_back( + std::to_string(static_cast<std::underlying_type<LogLevel>::type>( + arguments.log.log_limit))); + if (arguments.log.plain_log) { + cmd.emplace_back("--plain-log"); + } // add args read from just-mrrc if (subcommand and arguments.just_cmd.just_args.contains(*subcommand)) { for (auto const& subcmd_arg : |