diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-02-17 11:38:46 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-02-17 11:38:46 +0000 |
commit | cd169795faeebbbf799bf3334697dc302c1c084f (patch) | |
tree | 239cd894e1e561df264c9864f77156d433a6bbb2 /src | |
parent | 2a22f706c2ee399e7932772be3ed94c47f487913 (diff) | |
download | rspamd-cd169795faeebbbf799bf3334697dc302c1c084f.tar.gz rspamd-cd169795faeebbbf799bf3334697dc302c1c084f.zip |
[Fix] Switch rspamadm logging to message level
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/logger.h | 8 | ||||
-rw-r--r-- | src/lua/lua_logger.c | 32 | ||||
-rw-r--r-- | src/rspamadm/rspamadm.c | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/src/libutil/logger.h b/src/libutil/logger.h index 9b94c03ee..e48e1161a 100644 --- a/src/libutil/logger.h +++ b/src/libutil/logger.h @@ -200,6 +200,10 @@ extern guint rspamd_task_log_id; NULL, NULL, \ G_STRFUNC, \ __VA_ARGS__) +#define msg_notice(...) rspamd_default_log_function (G_LOG_LEVEL_MESSAGE, \ + NULL, NULL, \ + G_STRFUNC, \ + __VA_ARGS__) #define msg_debug(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG, \ NULL, NULL, \ G_STRFUNC, \ @@ -220,6 +224,10 @@ extern guint rspamd_task_log_id; task->task_pool->tag.tagname, task->task_pool->tag.uid, \ G_STRFUNC, \ __VA_ARGS__) +#define msg_notice_task(...) rspamd_default_log_function (G_LOG_LEVEL_MESSAGE, \ + task->task_pool->tag.tagname, task->task_pool->tag.uid, \ + G_STRFUNC, \ + __VA_ARGS__) #define msg_info_task(...) rspamd_default_log_function (G_LOG_LEVEL_INFO, \ task->task_pool->tag.tagname, task->task_pool->tag.uid, \ G_STRFUNC, \ diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c index da950030d..65461a655 100644 --- a/src/lua/lua_logger.c +++ b/src/lua/lua_logger.c @@ -75,6 +75,12 @@ LUA_FUNCTION_DEF (logger, warn); */ LUA_FUNCTION_DEF (logger, info); /*** + * @function logger.message(msg) + * Log message as an notice message + * @param {string} msg string to be logged + */ +LUA_FUNCTION_DEF (logger, message); +/*** * @function logger.debug(msg) * Log message as a debug message * @param {string} msg string to be logged @@ -102,6 +108,13 @@ LUA_FUNCTION_DEF (logger, warnx); */ LUA_FUNCTION_DEF (logger, infox); /*** + * @function logger.infox(fmt[, args) + * Extended interface to make an informational log message + * @param {string} fmt format string, arguments are encoded as %<number> + * @param {any} args list of arguments to be replaced in %<number> positions + */ +LUA_FUNCTION_DEF (logger, messagex); +/*** * @function logger.debugx(fmt[, args) * Extended interface to make a debug log message * @param {string} fmt format string, arguments are encoded as %<number> @@ -130,11 +143,15 @@ LUA_FUNCTION_DEF (logger, slog); static const struct luaL_reg loggerlib_f[] = { LUA_INTERFACE_DEF (logger, err), LUA_INTERFACE_DEF (logger, warn), + LUA_INTERFACE_DEF (logger, message), + {"msg", lua_logger_message}, LUA_INTERFACE_DEF (logger, info), LUA_INTERFACE_DEF (logger, debug), LUA_INTERFACE_DEF (logger, errx), LUA_INTERFACE_DEF (logger, warnx), LUA_INTERFACE_DEF (logger, infox), + LUA_INTERFACE_DEF (logger, messagex), + {"msgx", lua_logger_messagex}, LUA_INTERFACE_DEF (logger, debugx), LUA_INTERFACE_DEF (logger, debugm), LUA_INTERFACE_DEF (logger, slog), @@ -237,6 +254,15 @@ lua_logger_info (lua_State *L) } static gint +lua_logger_message (lua_State *L) +{ + const gchar *msg; + msg = luaL_checkstring (L, 1); + lua_common_log_line (G_LOG_LEVEL_MESSAGE, L, msg, NULL, NULL); + return 0; +} + +static gint lua_logger_debug (lua_State *L) { const gchar *msg; @@ -712,6 +738,12 @@ lua_logger_infox (lua_State *L) } static gint +lua_logger_messagex (lua_State *L) +{ + return lua_logger_logx (L, G_LOG_LEVEL_MESSAGE, FALSE); +} + +static gint lua_logger_debugx (lua_State *L) { return lua_logger_logx (L, G_LOG_LEVEL_DEBUG, FALSE); diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c index 51c621744..c42a76a09 100644 --- a/src/rspamadm/rspamadm.c +++ b/src/rspamadm/rspamadm.c @@ -297,7 +297,7 @@ main (gint argc, gchar **argv, gchar **env) cfg->log_level = G_LOG_LEVEL_DEBUG; } else { - cfg->log_level = G_LOG_LEVEL_INFO; + cfg->log_level = G_LOG_LEVEL_MESSAGE; } cfg->log_type = RSPAMD_LOG_CONSOLE; |