aboutsummaryrefslogtreecommitdiff
path: root/src/zen/cmds/admin_cmd.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-08-26 11:43:54 +0200
committerGitHub Enterprise <[email protected]>2025-08-26 11:43:54 +0200
commitb734de7c3a36bc5ccef84c1c940e0e3208e96506 (patch)
tree75d3a936566987585b449c42ff867b9c9e5b404b /src/zen/cmds/admin_cmd.cpp
parentrevert multi-cid store (#475) (diff)
downloadarchived-zen-b734de7c3a36bc5ccef84c1c940e0e3208e96506.tar.xz
archived-zen-b734de7c3a36bc5ccef84c1c940e0e3208e96506.zip
improve console output (#476)
* add color coded logging level to console output (for warn/err/crit levels) * clean up console output
Diffstat (limited to 'src/zen/cmds/admin_cmd.cpp')
-rw-r--r--src/zen/cmds/admin_cmd.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/zen/cmds/admin_cmd.cpp b/src/zen/cmds/admin_cmd.cpp
index fe2bbbdc7..dca6da6c4 100644
--- a/src/zen/cmds/admin_cmd.cpp
+++ b/src/zen/cmds/admin_cmd.cpp
@@ -51,17 +51,17 @@ ScrubCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (HttpClient::Response Response = Http.Post("/admin/scrub"sv, /* headers */ HttpClient::KeyValueMap{}, Params))
{
- ZEN_CONSOLE("scrub started OK: {}", Response.ToText());
+ ZEN_CONSOLE("Scrub started OK: {}", Response.ToText());
return 0;
}
else if (int StatusCode = (int)Response.StatusCode)
{
- ZEN_ERROR("scrub start failed: {}: {} ({})", StatusCode, ReasonStringForHttpResultCode(StatusCode), Response.ToText());
+ ZEN_CONSOLE_ERROR("Scrub start failed: {}: {} ({})", StatusCode, ReasonStringForHttpResultCode(StatusCode), Response.ToText());
}
else
{
- ZEN_ERROR("scrub start failed: {}", Response.ToText());
+ ZEN_CONSOLE_ERROR("Scrub start failed: {}", Response.ToText());
}
return 1;
@@ -259,11 +259,11 @@ GcCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (Result.status_code)
{
- ZEN_ERROR("GC start failed: {}: {} ({})", Result.status_code, Result.reason, Result.text);
+ ZEN_CONSOLE_ERROR("GC start failed: {}: {} ({})", Result.status_code, Result.reason, Result.text);
}
else
{
- ZEN_ERROR("GC start failed: {}", Result.error.message);
+ ZEN_CONSOLE_ERROR("GC start failed: {}", Result.error.message);
}
return 1;
@@ -315,11 +315,11 @@ GcStatusCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (Result.status_code)
{
- ZEN_ERROR("GC status failed: {}: {} ({})", Result.status_code, Result.reason, Result.text);
+ ZEN_CONSOLE_ERROR("GC status failed: {}: {} ({})", Result.status_code, Result.reason, Result.text);
}
else
{
- ZEN_ERROR("GC status failed: {}", Result.error.message);
+ ZEN_CONSOLE_ERROR("GC status failed: {}", Result.error.message);
}
return 1;
@@ -369,11 +369,11 @@ GcStopCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (Result.status_code)
{
- ZEN_ERROR("GC status failed: {}: {} ({})", Result.status_code, Result.reason, Result.text);
+ ZEN_CONSOLE_ERROR("GC status failed: {}: {} ({})", Result.status_code, Result.reason, Result.text);
}
else
{
- ZEN_ERROR("GC status failed: {}", Result.error.message);
+ ZEN_CONSOLE_ERROR("GC status failed: {}", Result.error.message);
}
return 1;
@@ -416,7 +416,7 @@ JobCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (m_JobId == 0)
{
- ZEN_ERROR("Job id must be given");
+ throw OptionParseException("Job id must be given");
return 1;
}
}
@@ -514,7 +514,7 @@ LoggingCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
else
{
- ZEN_ERROR("Invalid value for parameter 'cache-write-log'. Use 'enable' or 'disable'");
+ ZEN_CONSOLE_ERROR("Invalid value for parameter 'cache-write-log'. Use 'enable' or 'disable'");
return 1;
}
}
@@ -531,7 +531,7 @@ LoggingCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
else
{
- ZEN_ERROR("Invalid value for parameter 'cache-access-log'. Use 'enable' or 'disable'");
+ ZEN_CONSOLE_ERROR("Invalid value for parameter 'cache-access-log'. Use 'enable' or 'disable'");
return 1;
}
}
@@ -551,12 +551,12 @@ LoggingCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
auto CopyLog = [](std::string_view SourceName, std::string_view SourcePath, std::string_view TargetPath) -> bool {
if (SourcePath.empty())
{
- ZEN_ERROR("Failed to retrieve {} log path", SourceName);
+ ZEN_CONSOLE_ERROR("Failed to retrieve {} log path", SourceName);
return false;
}
if (!CopyFile(SourcePath, TargetPath, {}))
{
- ZEN_ERROR("Failed to copy {} log file {} to output file '{}'", SourceName, SourcePath, TargetPath);
+ ZEN_CONSOLE_ERROR("Failed to copy {} log file {} to output file '{}'", SourceName, SourcePath, TargetPath);
return false;
}
return true;
@@ -642,11 +642,11 @@ FlushCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
else if (int StatusCode = (int)Response.StatusCode)
{
- ZEN_ERROR("flush failed: {}: {} ({})", StatusCode, ReasonStringForHttpResultCode(StatusCode), Response.ToText());
+ ZEN_CONSOLE_ERROR("Flush failed: {}: {} ({})", StatusCode, ReasonStringForHttpResultCode(StatusCode), Response.ToText());
}
else
{
- ZEN_ERROR("flush failed: {}", Response.ToText());
+ ZEN_CONSOLE_ERROR("Flush failed: {}", Response.ToText());
}
return 1;