actually make use of the LogLevel type

why else would it be defined?
and this is sane anyway.
This commit is contained in:
Dieter Plaetinck
2016-02-01 17:48:42 +13:00
parent 3f5b33b060
commit bf943ddba3
4 changed files with 15 additions and 14 deletions
+7 -6
View File
@@ -99,7 +99,7 @@ func Close() {
type LogLevel int
const (
TRACE = iota
TRACE LogLevel = iota
DEBUG
INFO
WARN
@@ -111,7 +111,7 @@ const (
// LoggerInterface represents behaviors of a logger provider.
type LoggerInterface interface {
Init(config string) error
WriteMsg(msg string, skip, level int) error
WriteMsg(msg string, skip int, level LogLevel) error
Destroy()
Flush()
}
@@ -132,8 +132,9 @@ func Register(name string, log loggerType) {
}
type logMsg struct {
skip, level int
msg string
skip int
level LogLevel
msg string
}
// Logger is default logger in beego application.
@@ -141,7 +142,7 @@ type logMsg struct {
type Logger struct {
adapter string
lock sync.Mutex
level int
level LogLevel
msg chan *logMsg
outputs map[string]LoggerInterface
quit chan bool
@@ -188,7 +189,7 @@ func (l *Logger) DelLogger(adapter string) error {
return nil
}
func (l *Logger) writerMsg(skip, level int, msg string) error {
func (l *Logger) writerMsg(skip int, level LogLevel, msg string) error {
if l.level > level {
return nil
}