forked from vieter-v/vieter
				
			Merge pull request 'Fix for configured log level being ignored.' (#339) from GreekStapler/vieter:fix/logging_level into dev
Reviewed-on: vieter-v/vieter#339remotes/1739821333615734048/dev
						commit
						bfd28d6f70
					
				|  | @ -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) | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -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) | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -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) | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue