summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/just-mr.1.org7
-rw-r--r--src/other_tools/just_mr/cli.hpp5
-rw-r--r--src/other_tools/just_mr/main.cpp21
3 files changed, 31 insertions, 2 deletions
diff --git a/share/man/just-mr.1.org b/share/man/just-mr.1.org
index b7a128f1..1e23b772 100644
--- a/share/man/just-mr.1.org
+++ b/share/man/just-mr.1.org
@@ -79,6 +79,9 @@ See *just-mr-repository-config(5)* for more details on the input format.
*--plain-log*\\
Do not use ANSI escape sequences to highlight messages.
+ *--log_append*\\
+ Append messages to log file instead of overwriting existing.
+
*--just* PATH\\
Name of the just binary in ~PATH~ or path to the just binary.\\
Default: ~"just"~.\\
@@ -166,6 +169,10 @@ be provided in the configuration or on the command line. If no main repository
is provided, the lexicographical first repository from the configuration is
used.
+All logging arguments given to ~just-mr~ are passed to ~just~ as early arguments.
+If log files are provided, an unconditional ~--log-append~ argument is passed as
+well, which ensures no log messages will get overwritten.
+
** version|describe|analyse|build|install|install-cas|rebuild|gc
This subcommand is the explicit way of specifying /known/ just subcommands and
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 :