浏览代码

Fixed logger interface

Signed-off-by: Vishal Rana <vr@labstack.com>
Vishal Rana 6 年之前
父节点
当前提交
4347fbac6d
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      log/log.go

+ 8 - 6
log/log.go

@@ -32,6 +32,8 @@ type (
 		mutex      sync.Mutex
 		mutex      sync.Mutex
 	}
 	}
 
 
+	Lvl uint8
+
 	JSON map[string]interface{}
 	JSON map[string]interface{}
 )
 )
 
 
@@ -108,12 +110,12 @@ func (l *Logger) SetPrefix(p string) {
 	l.prefix = p
 	l.prefix = p
 }
 }
 
 
-func (l *Logger) Level() uint32 {
-	return atomic.LoadUint32(&l.level)
+func (l *Logger) Level() Lvl {
+	return Lvl(atomic.LoadUint32(&l.level))
 }
 }
 
 
-func (l *Logger) SetLevel(level uint32) {
-	atomic.StoreUint32(&l.level, level)
+func (l *Logger) SetLevel(level Lvl) {
+	atomic.StoreUint32(&l.level, uint32(level))
 }
 }
 
 
 func (l *Logger) Output() io.Writer {
 func (l *Logger) Output() io.Writer {
@@ -242,11 +244,11 @@ func SetPrefix(p string) {
 	global.SetPrefix(p)
 	global.SetPrefix(p)
 }
 }
 
 
-func Level() uint32 {
+func Level() Lvl {
 	return global.Level()
 	return global.Level()
 }
 }
 
 
-func SetLevel(level uint32) {
+func SetLevel(level Lvl) {
 	global.SetLevel(level)
 	global.SetLevel(level)
 }
 }