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