|
|
|
@ -8,6 +8,9 @@
|
|
|
|
|
#include "spdlog/details/synchronous_factory.h"
|
|
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
#ifndef SD_JOURNAL_SUPPRESS_LOCATION
|
|
|
|
|
#define SD_JOURNAL_SUPPRESS_LOCATION
|
|
|
|
|
#endif
|
|
|
|
|
#include <systemd/sd-journal.h>
|
|
|
|
|
|
|
|
|
|
namespace spdlog {
|
|
|
|
@ -58,12 +61,14 @@ protected:
|
|
|
|
|
{
|
|
|
|
|
// Note: function call inside '()' to avoid macro expansion
|
|
|
|
|
err = (sd_journal_send)(
|
|
|
|
|
"MESSAGE=%.*s", static_cast<int>(length), msg.payload.data(), "PRIORITY=%d", syslog_level(msg.level), nullptr);
|
|
|
|
|
"MESSAGE=%.*s", static_cast<int>(length), msg.payload.data(), "PRIORITY=%d", syslog_level(msg.level),
|
|
|
|
|
"SYSLOG_IDENTIFIER=%.*s", static_cast<int>(msg.logger_name.size()), msg.logger_name.data(), nullptr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), msg.payload.data(), "PRIORITY=%d", syslog_level(msg.level),
|
|
|
|
|
"SOURCE_FILE=%s", msg.source.filename, "SOURCE_LINE=%d", msg.source.line, "SOURCE_FUNC=%s", msg.source.funcname, nullptr);
|
|
|
|
|
"SYSLOG_IDENTIFIER=%.*s", static_cast<int>(msg.logger_name.size()), msg.logger_name.data(),
|
|
|
|
|
"CODE_FILE=%s", msg.source.filename, "CODE_LINE=%d", msg.source.line, "CODE_FUNC=%s", msg.source.funcname, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|