Compare commits
16 commits
b47d78c41c
...
433184877c
| Author | SHA1 | Date | |
|---|---|---|---|
| 433184877c | |||
| 4fb6f629ac | |||
| 2e6ac5cda6 | |||
| d6b7ce98c1 | |||
| 86e519a185 | |||
| 801a2cd495 | |||
| 3f1aea13e2 | |||
| dce00bfab6 | |||
| c2e6d168e5 | |||
| fec8118ff5 | |||
| 84e7e14a19 | |||
| 2d50889e8e | |||
| aba1ff4de7 | |||
| d0b5314619 | |||
| bfd28d6f70 | |||
| 8432f5915d |
2 changed files with 30 additions and 28 deletions
|
|
@ -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 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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue