I want to append more output to last output.
Something like that:
logger->info("Starting...");
//...something...
if(!fail)
logger->append("OK");
But I didnt find any append options in spdlog wiki. Maybe not append, but output changing options exist? Like in systemd initialisation when [OK] at the end written after actual check. Or maybe I need to use another logging lib?
I want to append more output to last output.
Something like that:
logger->info("Starting...");
//...something...
if(!fail)
logger->append("OK");
But I didnt find any append options in spdlog wiki. Maybe not append, but output changing options exist? Like in systemd initialisation when [OK] at the end written after actual check. Or maybe I need to use another logging lib?
spdlog does not have an "append" option to modify an already-logged message in place, because logging libraries are typically designed to output complete log messages in an atomic way. However, there are workarounds to achieve similar functionality depending on your needs,
You could buffer the output and write it only after the status is determined:
std::ostringstream oss;
oss << "Starting...";
if (!fail) {
oss << " OK";
} else {
oss << " FAILED";
}
logger->info(oss.str());
#define SPDLOG_EOL ""
in tweakme.h? – Jarod42 Commented Jan 4 at 17:09\n
to every completed message? – Supreme Machine Commented Jan 4 at 17:40