{
try {
sd_journal_send("PRIORITY=%d", journalLevel.at(level),
- "CODE_FILE=%s", fileName,
- "CODE_FUNC=%s", function,
- "CODE_LINE=%d", line,
- "MESSAGE=%s", message,
- NULL);
+ "CODE_FILE=%s", fileName,
+ "CODE_FUNC=%s", function,
+ "CODE_LINE=%d", line,
+ // add file, line & function info to log message
+ "MESSAGE=[%s:%d] %s(): %s", fileName, line, function, message,
+ NULL);
} catch (const std::out_of_range&) {
- sd_journal_send("PRIORITY=%d", LOG_ERR,
- "CODE_FILE=%s", fileName,
- "CODE_FUNC=%s", function,
- "CODE_LINE=%d", line,
- "MESSAGE=Unsupported log level %d", level,
- NULL);
+ sd_journal_send(
+ "PRIORITY=%d", LOG_ERR,
+ "CODE_FILE=%s", fileName,
+ "CODE_FUNC=%s", function,
+ "CODE_LINE=%d", line,
+ // add file, line & function info to log message
+ "MESSAGE=[%s:%d] %s(): Unsupported log level %d", fileName, line, function, level,
+ NULL);
}
}
namespace Log {
namespace // anonymous
{
+/*
+ * Set these variables to desired values in /etc/sysconfig/central-key-manager and restart
+ * central-key-manager service to use them.
+ *
+ * Example:
+ * CKM_LOG_LEVEL=3
+ * CKM_LOG_PROVIDER=JOURNALD
+ */
const char * const CKM_LOG_LEVEL = "CKM_LOG_LEVEL";
const char * const CKM_LOG_PROVIDER = "CKM_LOG_PROVIDER";