summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-02-27 10:34:27 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-02-27 11:11:29 +0100
commitbd657023d6da9fbc60b64d4b53db005f347dc874 (patch)
tree8ba931a622184961c5b4efa120e17a70a2d3e0ee
parente353e7169e6ec68ee7bb520b3a0240928ee19b0f (diff)
downloadjustbuild-bd657023d6da9fbc60b64d4b53db005f347dc874.tar.gz
Logging: Add --log-append clarg to just
-rw-r--r--share/man/just.1.org8
-rw-r--r--src/buildtool/common/cli.hpp5
-rw-r--r--src/buildtool/main/main.cpp6
3 files changed, 15 insertions, 4 deletions
diff --git a/share/man/just.1.org b/share/man/just.1.org
index eee7e146..a08eecbc 100644
--- a/share/man/just.1.org
+++ b/share/man/just.1.org
@@ -252,7 +252,7 @@ and the corresponding disk space reclaimed.
This subcommand starts a single node remote execution service,
honoring the just native remote protocol.
-
+
If the flag --compatible is provided, the execution service will honor
the original remote build execution protocol.
@@ -392,6 +392,10 @@ the original remote build execution protocol.
Do not use ANSI escape sequences to highlight messages.\\
Supported by: analyse|build|describe|install|install-cas|rebuild|traverse|gc|execute.
+ *--log-append*\\
+ Append messages to log file instead of overwriting existing.\\
+ Supported by: analyse|build|describe|install|install-cas|rebuild|traverse|gc|execute.
+
*--expression-log-limit* NUM\\
In error messages, truncate the entries in the enumeration of the active
environment, as well as the expression to be evaluated, to the specified
@@ -454,7 +458,7 @@ the original remote build execution protocol.
Path to a TLS CA certificate that is trusted to sign the server
certificate.
Supported by: build|install-cas|install|rebuild|traverse|execute.
-
+
*--tls-client-cert* PATH\\
Path to a TLS client certificate to enable mTLS. It must be passed
in conjunction with *--tls-client-key* and *--tls-ca-cert*.
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 46e8a7c9..865ef500 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -45,6 +45,7 @@ struct LogArguments {
std::vector<std::filesystem::path> log_files{};
LogLevel log_limit{kDefaultLogLevel};
bool plain_log{false};
+ bool log_append{false};
};
/// \brief Arguments required for analysing targets.
@@ -201,6 +202,10 @@ static inline auto SetupLogArguments(
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 auto SetupAnalysisArguments(
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 3e23cf63..d3911bf1 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -288,8 +288,10 @@ void SetupLogging(LogArguments 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));
}
}