aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/logger
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2020-10-14 10:03:20 +0200
committerAndrew Lewis <nerf@judo.za.org>2020-10-14 10:03:20 +0200
commit6cdd90b7cabb77b970f646cdeef54a3ffa9f07d2 (patch)
treef94d66637ef4c79cbe31cac4914d608430ec46dd /src/libserver/logger
parentea6b7cea9d8909a7f161ae477b254dbe1a89b6d4 (diff)
downloadrspamd-6cdd90b7cabb77b970f646cdeef54a3ffa9f07d2.tar.gz
rspamd-6cdd90b7cabb77b970f646cdeef54a3ffa9f07d2.zip
[Fix] Honour `systemd` setting when logging to console (#3514)
Diffstat (limited to 'src/libserver/logger')
-rw-r--r--src/libserver/logger/logger_console.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/libserver/logger/logger_console.c b/src/libserver/logger/logger_console.c
index b348aa929..9aad85f6e 100644
--- a/src/libserver/logger/logger_console.c
+++ b/src/libserver/logger/logger_console.c
@@ -179,8 +179,11 @@ rspamd_log_console_log (const gchar *module, const gchar *id,
rspamd_file_lock (fd, FALSE);
#endif
- log_time (rspamd_get_calendar_ticks (),
- rspamd_log, timebuf, sizeof (timebuf));
+ if (!(rspamd_log->flags & RSPAMD_LOG_FLAG_SYSTEMD)) {
+ log_time (rspamd_get_calendar_ticks (),
+ rspamd_log, timebuf, sizeof (timebuf));
+ }
+
if (priv->log_color) {
if (level_flags & (G_LOG_LEVEL_INFO|G_LOG_LEVEL_MESSAGE)) {
/* White */
@@ -215,12 +218,20 @@ rspamd_log_console_log (const gchar *module, const gchar *id,
iov[niov++].iov_len = 1;
}
else {
- r += rspamd_snprintf (tmpbuf + r,
- sizeof (tmpbuf) - r,
- "%s #%P(%s) ",
- timebuf,
- rspamd_log->pid,
- rspamd_log->process_type);
+ if (!(rspamd_log->flags & RSPAMD_LOG_FLAG_SYSTEMD)) {
+ r += rspamd_snprintf (tmpbuf + r,
+ sizeof (tmpbuf) - r,
+ "%s #%P(%s) ",
+ timebuf,
+ rspamd_log->pid,
+ rspamd_log->process_type);
+ } else {
+ r += rspamd_snprintf (tmpbuf + r,
+ sizeof (tmpbuf) - r,
+ "#%P(%s) ",
+ rspamd_log->pid,
+ rspamd_log->process_type);
+ }
modulebuf[0] = '\0';
mremain = sizeof (modulebuf);