aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-02-17 11:38:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-02-17 11:38:46 +0000
commitcd169795faeebbbf799bf3334697dc302c1c084f (patch)
tree239cd894e1e561df264c9864f77156d433a6bbb2 /src/lua
parent2a22f706c2ee399e7932772be3ed94c47f487913 (diff)
downloadrspamd-cd169795faeebbbf799bf3334697dc302c1c084f.tar.gz
rspamd-cd169795faeebbbf799bf3334697dc302c1c084f.zip
[Fix] Switch rspamadm logging to message level
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_logger.c32
1 files changed, 32 insertions, 0 deletions
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);