|
|
@ -20,6 +20,7 @@ import (
|
|
|
|
"github.com/fatedier/beego/logs"
|
|
|
|
"github.com/fatedier/beego/logs"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Log is the under log object
|
|
|
|
var Log *logs.BeeLogger
|
|
|
|
var Log *logs.BeeLogger
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
@ -33,6 +34,7 @@ func InitLog(logWay string, logFile string, logLevel string, maxdays int64) {
|
|
|
|
SetLogLevel(logLevel)
|
|
|
|
SetLogLevel(logLevel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetLogFile to configure log params
|
|
|
|
// logWay: file or console
|
|
|
|
// logWay: file or console
|
|
|
|
func SetLogFile(logWay string, logFile string, maxdays int64) {
|
|
|
|
func SetLogFile(logWay string, logFile string, maxdays int64) {
|
|
|
|
if logWay == "console" {
|
|
|
|
if logWay == "console" {
|
|
|
@ -43,6 +45,7 @@ func SetLogFile(logWay string, logFile string, maxdays int64) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetLogLevel set log level, default is warning
|
|
|
|
// value: error, warning, info, debug, trace
|
|
|
|
// value: error, warning, info, debug, trace
|
|
|
|
func SetLogLevel(logLevel string) {
|
|
|
|
func SetLogLevel(logLevel string) {
|
|
|
|
level := 4 // warning
|
|
|
|
level := 4 // warning
|
|
|
@ -85,7 +88,7 @@ func Trace(format string, v ...interface{}) {
|
|
|
|
Log.Trace(format, v...)
|
|
|
|
Log.Trace(format, v...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Logger
|
|
|
|
// Logger is the log interface
|
|
|
|
type Logger interface {
|
|
|
|
type Logger interface {
|
|
|
|
AddLogPrefix(string)
|
|
|
|
AddLogPrefix(string)
|
|
|
|
GetPrefixStr() string
|
|
|
|
GetPrefixStr() string
|
|
|
|