summaryrefslogtreecommitdiff
path: root/src/other_tools
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-25 09:18:46 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-25 11:47:15 +0200
commit10caf1e1fba66899ddf9b4d047cd21e04e21142e (patch)
treeb4090fee9654065797d603d800c7a48dc541bfbc /src/other_tools
parent15f3c80f2a22b136e11f0118f4886a8668469c1f (diff)
downloadjustbuild-10caf1e1fba66899ddf9b4d047cd21e04e21142e.tar.gz
just-mr: support custom message with invocation-directory name
Allow to specify a custom string that is extended by the basename of the logging directory, in case invocation logging is activated. This can be used, e.g., to point to the user to service doing something useful with the logged data (or simply presenting it in a nicer form).
Diffstat (limited to 'src/other_tools')
-rw-r--r--src/other_tools/just_mr/cli.hpp1
-rw-r--r--src/other_tools/just_mr/launch.cpp6
-rw-r--r--src/other_tools/just_mr/rc.cpp5
3 files changed, 12 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index de1ac9d0..dd1586a4 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -92,6 +92,7 @@ struct MultiRepoGcArguments {
// Arguments for invocation logging; set only via rc files
struct InvocationLogArguments {
std::optional<std::filesystem::path> directory{std::nullopt};
+ std::optional<std::string> invocation_msg{std::nullopt};
std::optional<std::string> project_id{std::nullopt};
std::optional<std::string> metadata{std::nullopt};
std::optional<std::string> graph_file{std::nullopt};
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp
index 76272213..cb0f70d2 100644
--- a/src/other_tools/just_mr/launch.cpp
+++ b/src/other_tools/just_mr/launch.cpp
@@ -285,6 +285,12 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file,
"{:%Y-%m-%d-%H:%M}-{}", fmt::gmtime(invocation_time), uuid);
dir = dir / invocation_id;
if (FileSystemManager::CreateDirectoryExclusive(dir)) {
+ if (invocation_log.invocation_msg) {
+ Logger::Log(LogLevel::Info,
+ "{}{}",
+ *invocation_log.invocation_msg,
+ invocation_id);
+ }
Logger::Log(
LogLevel::Info, "Invocation logged at {}", dir.string());
log_dir = dir;
diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp
index bcb217cf..5baf302c 100644
--- a/src/other_tools/just_mr/rc.cpp
+++ b/src/other_tools/just_mr/rc.cpp
@@ -624,6 +624,11 @@ namespace {
if (profile->IsString()) {
clargs->invocation_log.profile = profile->String();
}
+ auto msg =
+ invocation_log->Get("invocation message", Expression::none_t{});
+ if (msg->IsString()) {
+ clargs->invocation_log.invocation_msg = msg->String();
+ }
}
}
// read config lookup order