summaryrefslogtreecommitdiffstats
path: root/src/libutil/logger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/logger.c')
-rw-r--r--src/libutil/logger.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/libutil/logger.c b/src/libutil/logger.c
index 7a10b4ec7..cca21f870 100644
--- a/src/libutil/logger.c
+++ b/src/libutil/logger.c
@@ -748,9 +748,12 @@ file_log_function (const gchar *log_domain,
}
/* Format time */
- tms = localtime (&now);
+ if (!rspamd_log->cfg->log_systemd) {
+ tms = localtime (&now);
+
+ strftime (timebuf, sizeof (timebuf), "%F %H:%M:%S", tms);
+ }
- strftime (timebuf, sizeof (timebuf), "%F %H:%M:%S", tms);
cptype = g_quark_to_string (rspamd_log->process_type);
if (rspamd_log->cfg->log_color) {
@@ -771,12 +774,20 @@ file_log_function (const gchar *log_domain,
r = 0;
}
- r += rspamd_snprintf (tmpbuf + r,
- sizeof (tmpbuf) - r,
- "%s #%P(%s) ",
- timebuf,
- rspamd_log->pid,
- cptype);
+ if (!rspamd_log->cfg->log_systemd) {
+ r += rspamd_snprintf (tmpbuf + r,
+ sizeof (tmpbuf) - r,
+ "%s #%P(%s) ",
+ timebuf,
+ rspamd_log->pid,
+ cptype);
+ }
+ else {
+ r += rspamd_snprintf (tmpbuf + r,
+ sizeof (tmpbuf) - r,
+ "(%s) ",
+ cptype);
+ }
modulebuf[0] = '\0';
mremain = sizeof (modulebuf);