From 8432f5915d51ae485313cdd03ea0d9983e1425a9 Mon Sep 17 00:00:00 2001 From: GreekStapler Date: Sat, 7 Jan 2023 21:09:55 +0000 Subject: [PATCH] Fix for configured log level being ignored. --- src/agent/log.v | 29 +++++++++++++++-------------- src/cron/daemon/log.v | 29 +++++++++++++++-------------- src/web/logging.v | 29 +++++++++++++++-------------- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/agent/log.v b/src/agent/log.v index cd59207..fcd8373 100644 --- a/src/agent/log.v +++ b/src/agent/log.v @@ -1,35 +1,36 @@ module agent -import log - -// log a message with the given level -pub fn (mut d AgentDaemon) log(msg string, level log.Level) { - lock d.logger { - d.logger.send_output(msg, level) - } -} - // lfatal create a log message with the fatal level pub fn (mut d AgentDaemon) lfatal(msg string) { - d.log(msg, log.Level.fatal) + lock d.logger { + d.logger.fatal(msg) + } } // lerror create a log message with the error level pub fn (mut d AgentDaemon) lerror(msg string) { - d.log(msg, log.Level.error) + lock d.logger { + d.logger.error(msg) + } } // lwarn create a log message with the warn level pub fn (mut d AgentDaemon) lwarn(msg string) { - d.log(msg, log.Level.warn) + lock d.logger { + d.logger.warn(msg) + } } // linfo create a log message with the info level pub fn (mut d AgentDaemon) linfo(msg string) { - d.log(msg, log.Level.info) + lock d.logger { + d.logger.info(msg) + } } // ldebug create a log message with the debug level pub fn (mut d AgentDaemon) ldebug(msg string) { - d.log(msg, log.Level.debug) + lock d.logger { + d.logger.debug(msg) + } } diff --git a/src/cron/daemon/log.v b/src/cron/daemon/log.v index 95a50e7..4f978fc 100644 --- a/src/cron/daemon/log.v +++ b/src/cron/daemon/log.v @@ -1,35 +1,36 @@ module daemon -import log - -// log reate a log message with the given level -pub fn (mut d Daemon) log(msg string, level log.Level) { - lock d.logger { - d.logger.send_output(msg, level) - } -} - // lfatal create a log message with the fatal level pub fn (mut d Daemon) lfatal(msg string) { - d.log(msg, log.Level.fatal) + lock d.logger { + d.logger.fatal(msg) + } } // lerror create a log message with the error level pub fn (mut d Daemon) lerror(msg string) { - d.log(msg, log.Level.error) + lock d.logger { + d.logger.error(msg) + } } // lwarn create a log message with the warn level pub fn (mut d Daemon) lwarn(msg string) { - d.log(msg, log.Level.warn) + lock d.logger { + d.logger.warn(msg) + } } // linfo create a log message with the info level pub fn (mut d Daemon) linfo(msg string) { - d.log(msg, log.Level.info) + lock d.logger { + d.logger.info(msg) + } } // ldebug create a log message with the debug level pub fn (mut d Daemon) ldebug(msg string) { - d.log(msg, log.Level.debug) + lock d.logger { + d.logger.debug(msg) + } } diff --git a/src/web/logging.v b/src/web/logging.v index 12b07d7..7ba649c 100644 --- a/src/web/logging.v +++ b/src/web/logging.v @@ -1,35 +1,36 @@ module web -import log - -// log reate a log message with the given level -pub fn (mut ctx Context) log(msg string, level log.Level) { - lock ctx.logger { - ctx.logger.send_output(msg, level) - } -} - // lfatal create a log message with the fatal level pub fn (mut ctx Context) lfatal(msg string) { - ctx.log(msg, log.Level.fatal) + lock ctx.logger { + ctx.logger.fatal(msg) + } } // lerror create a log message with the error level pub fn (mut ctx Context) lerror(msg string) { - ctx.log(msg, log.Level.error) + lock ctx.logger { + ctx.logger.error(msg) + } } // lwarn create a log message with the warn level pub fn (mut ctx Context) lwarn(msg string) { - ctx.log(msg, log.Level.warn) + lock ctx.logger { + ctx.logger.warn(msg) + } } // linfo create a log message with the info level pub fn (mut ctx Context) linfo(msg string) { - ctx.log(msg, log.Level.info) + lock ctx.logger { + ctx.logger.info(msg) + } } // ldebug create a log message with the debug level pub fn (mut ctx Context) ldebug(msg string) { - ctx.log(msg, log.Level.debug) + lock ctx.logger { + ctx.logger.debug(msg) + } }