aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-14 12:56:02 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-14 12:56:02 +0000
commite36edd1c6074f882f11b5f47795dea8ba0460b4f (patch)
treed0c2a89aa4a34a3a0445cf13a30f54d2a3cfb0c3 /src/libserver
parentae55383e360503d272aa6b849368d3dd447c9754 (diff)
downloadrspamd-e36edd1c6074f882f11b5f47795dea8ba0460b4f.tar.gz
rspamd-e36edd1c6074f882f11b5f47795dea8ba0460b4f.zip
[Minor] Further logging improvements
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/logger.h2
-rw-r--r--src/libserver/logger/logger_console.c2
-rw-r--r--src/libserver/logger/logger_file.c2
-rw-r--r--src/libserver/logger/logger_private.h3
-rw-r--r--src/libserver/logger/logger_syslog.c2
5 files changed, 6 insertions, 5 deletions
diff --git a/src/libserver/logger.h b/src/libserver/logger.h
index f8ecbf1ee..c5cc5beed 100644
--- a/src/libserver/logger.h
+++ b/src/libserver/logger.h
@@ -13,6 +13,8 @@ extern "C" {
#define G_LOG_LEVEL_USER_SHIFT 8
#endif
+#define RSPAMD_LOG_ID_LEN 6
+
struct rspamd_config;
enum rspamd_log_flags {
diff --git a/src/libserver/logger/logger_console.c b/src/libserver/logger/logger_console.c
index 1bc91007a..b348aa929 100644
--- a/src/libserver/logger/logger_console.c
+++ b/src/libserver/logger/logger_console.c
@@ -228,7 +228,7 @@ rspamd_log_console_log (const gchar *module, const gchar *id,
if (id != NULL) {
guint slen = strlen (id);
- slen = MIN (LOG_ID, slen);
+ slen = MIN (RSPAMD_LOG_ID_LEN, slen);
mr = rspamd_snprintf (m, mremain, "<%*.s>; ", slen,
id);
m += mr;
diff --git a/src/libserver/logger/logger_file.c b/src/libserver/logger/logger_file.c
index d8ce15de2..3d5cc148b 100644
--- a/src/libserver/logger/logger_file.c
+++ b/src/libserver/logger/logger_file.c
@@ -526,7 +526,7 @@ rspamd_log_file_log (const gchar *module, const gchar *id,
if (id != NULL) {
guint slen = strlen (id);
- slen = MIN (LOG_ID, slen);
+ slen = MIN (RSPAMD_LOG_ID_LEN, slen);
mr = rspamd_snprintf (m, mremain, "<%*.s>; ", slen,
id);
m += mr;
diff --git a/src/libserver/logger/logger_private.h b/src/libserver/logger/logger_private.h
index 23361e38d..4b0dbfef5 100644
--- a/src/libserver/logger/logger_private.h
+++ b/src/libserver/logger/logger_private.h
@@ -19,7 +19,6 @@
/* How much message should be repeated before it is count to be repeated one */
#define REPEATS_MIN 3
#define REPEATS_MAX 300
-#define LOG_ID 6
#define LOGBUF_LEN 8192
struct rspamd_log_module {
@@ -39,7 +38,7 @@ struct rspamd_logger_error_elt {
GQuark ptype;
pid_t pid;
gdouble ts;
- gchar id[LOG_ID + 1];
+ gchar id[RSPAMD_LOG_ID_LEN + 1];
gchar module[9];
gchar message[];
};
diff --git a/src/libserver/logger/logger_syslog.c b/src/libserver/logger/logger_syslog.c
index ca7227990..ad10b7c13 100644
--- a/src/libserver/logger/logger_syslog.c
+++ b/src/libserver/logger/logger_syslog.c
@@ -92,7 +92,7 @@ rspamd_log_syslog_log (const gchar *module, const gchar *id,
}
syslog (syslog_level, "<%.*s>; %s; %s: %.*s",
- LOG_ID, id != NULL ? id : "",
+ RSPAMD_LOG_ID_LEN, id != NULL ? id : "",
module != NULL ? module : "",
function != NULL ? function : "",
(gint)mlen, message);