123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package logs
- import (
- "Cold_Api/conf"
- "github.com/astaxie/beego/logs"
- )
- var logx *logs.BeeLogger
- func init() {
- logx = logs.NewLogger()
- logx.SetLogger(logs.AdapterFile, `{"filename":"logs/logx/logx.log","color":true,"Perm":"777"}`)
- logx.EnableFuncCallDepth(true)
- logx.SetLogFuncCallDepth(3)
- logx.SetLevel(logs.LevelInformational)
- if conf.RunMode == "dev" {
- logx.SetLevel(logs.LevelDebug)
- logx.SetLogger(logs.AdapterConsole)
- }
- }
- func PPrintln(format string, v ...interface{}) {
- for _, _ = range v {
- format += " %v"
- }
- logx.Info(format, v...)
- }
- // Debug Log DEBUG level message.
- func DDebug(format string, v ...interface{}) {
- for _, _ = range v {
- format += " %v"
- }
- logx.Debug(format, v...)
- }
- // Info Log ERROR level message.
- func IInfo(format string, v ...interface{}) {
- for _, _ = range v {
- format += " %v"
- }
- logx.Info(format, v...)
- }
- // Error Log ERROR level message.
- func EError(format string, v ...interface{}) {
- for _, _ = range v {
- format += " %v"
- }
- logx.Error(format, v...)
- }
- // Warning Log WARNING level message.
- func WWarning(format string, v ...interface{}) {
- for _, _ = range v {
- format += " %v"
- }
- logx.Warning(format, v...)
- }
|