Compare commits
15 commits
433184877c
...
b47d78c41c
| Author | SHA1 | Date | |
|---|---|---|---|
| b47d78c41c | |||
| a135068b31 | |||
| 2f4acf59e3 | |||
| da5a77e489 | |||
| 8c0315dea6 | |||
| 243002f282 | |||
| f63cbd77d3 | |||
| fbc18386e2 | |||
| 292e43944e | |||
| 191ea1f2fe | |||
| d8e3dcb34f | |||
| 85ea7166fb | |||
| ee262a2fbc | |||
| c3f7f11686 | |||
| 7490668b44 |
2 changed files with 28 additions and 30 deletions
|
|
@ -1,36 +1,35 @@
|
|||
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) {
|
||||
lock d.logger {
|
||||
d.logger.fatal(msg)
|
||||
}
|
||||
d.log(msg, log.Level.fatal)
|
||||
}
|
||||
|
||||
// lerror create a log message with the error level
|
||||
pub fn (mut d AgentDaemon) lerror(msg string) {
|
||||
lock d.logger {
|
||||
d.logger.error(msg)
|
||||
}
|
||||
d.log(msg, log.Level.error)
|
||||
}
|
||||
|
||||
// lwarn create a log message with the warn level
|
||||
pub fn (mut d AgentDaemon) lwarn(msg string) {
|
||||
lock d.logger {
|
||||
d.logger.warn(msg)
|
||||
}
|
||||
d.log(msg, log.Level.warn)
|
||||
}
|
||||
|
||||
// linfo create a log message with the info level
|
||||
pub fn (mut d AgentDaemon) linfo(msg string) {
|
||||
lock d.logger {
|
||||
d.logger.info(msg)
|
||||
}
|
||||
d.log(msg, log.Level.info)
|
||||
}
|
||||
|
||||
// ldebug create a log message with the debug level
|
||||
pub fn (mut d AgentDaemon) ldebug(msg string) {
|
||||
lock d.logger {
|
||||
d.logger.debug(msg)
|
||||
}
|
||||
d.log(msg, log.Level.debug)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,35 @@
|
|||
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) {
|
||||
lock ctx.logger {
|
||||
ctx.logger.fatal(msg)
|
||||
}
|
||||
ctx.log(msg, log.Level.fatal)
|
||||
}
|
||||
|
||||
// lerror create a log message with the error level
|
||||
pub fn (mut ctx Context) lerror(msg string) {
|
||||
lock ctx.logger {
|
||||
ctx.logger.error(msg)
|
||||
}
|
||||
ctx.log(msg, log.Level.error)
|
||||
}
|
||||
|
||||
// lwarn create a log message with the warn level
|
||||
pub fn (mut ctx Context) lwarn(msg string) {
|
||||
lock ctx.logger {
|
||||
ctx.logger.warn(msg)
|
||||
}
|
||||
ctx.log(msg, log.Level.warn)
|
||||
}
|
||||
|
||||
// linfo create a log message with the info level
|
||||
pub fn (mut ctx Context) linfo(msg string) {
|
||||
lock ctx.logger {
|
||||
ctx.logger.info(msg)
|
||||
}
|
||||
ctx.log(msg, log.Level.info)
|
||||
}
|
||||
|
||||
// ldebug create a log message with the debug level
|
||||
pub fn (mut ctx Context) ldebug(msg string) {
|
||||
lock ctx.logger {
|
||||
ctx.logger.debug(msg)
|
||||
}
|
||||
ctx.log(msg, log.Level.debug)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue