mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 23:01:28 +00:00
compatiable for old version
This commit is contained in:
parent
63da329468
commit
1f8022d4ad
18
log.go
18
log.go
@ -1,6 +1,8 @@
|
|||||||
package beego
|
package beego
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/astaxie/beego/logs"
|
"github.com/astaxie/beego/logs"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,30 +37,34 @@ func SetLogger(adaptername string, config string) {
|
|||||||
|
|
||||||
// Trace logs a message at trace level.
|
// Trace logs a message at trace level.
|
||||||
func Trace(v ...interface{}) {
|
func Trace(v ...interface{}) {
|
||||||
BeeLogger.Trace("%v", v...)
|
BeeLogger.Trace(generateFmtStr(len(v)), v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug logs a message at debug level.
|
// Debug logs a message at debug level.
|
||||||
func Debug(v ...interface{}) {
|
func Debug(v ...interface{}) {
|
||||||
BeeLogger.Debug("%v", v...)
|
BeeLogger.Debug(generateFmtStr(len(v)), v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info logs a message at info level.
|
// Info logs a message at info level.
|
||||||
func Info(v ...interface{}) {
|
func Info(v ...interface{}) {
|
||||||
BeeLogger.Info("%v", v...)
|
BeeLogger.Info(generateFmtStr(len(v)), v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning logs a message at warning level.
|
// Warning logs a message at warning level.
|
||||||
func Warn(v ...interface{}) {
|
func Warn(v ...interface{}) {
|
||||||
BeeLogger.Warn("%v", v...)
|
BeeLogger.Warn(generateFmtStr(len(v)), v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error logs a message at error level.
|
// Error logs a message at error level.
|
||||||
func Error(v ...interface{}) {
|
func Error(v ...interface{}) {
|
||||||
BeeLogger.Error("%v", v...)
|
BeeLogger.Error(generateFmtStr(len(v)), v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Critical logs a message at critical level.
|
// Critical logs a message at critical level.
|
||||||
func Critical(v ...interface{}) {
|
func Critical(v ...interface{}) {
|
||||||
BeeLogger.Critical("%v", v...)
|
BeeLogger.Critical(generateFmtStr(len(v)), v...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateFmtStr(n int) string {
|
||||||
|
return strings.Repeat("%v ", n)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user