Browse Source

Fix crash

Yasuhiro Matsumoto 10 years ago
parent
commit
05f704a60a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      log/log.go

+ 1 - 1
log/log.go

@@ -151,7 +151,7 @@ func (l *Logger) log(v Level, w io.Writer, msg interface{}, args ...interface{})
 	l.Lock()
 	defer l.Unlock()
 	// }
-	if v >= l.level {
+	if v >= l.level && int(v) < len(levels) {
 		// TODO: Improve performance
 		f := fmt.Sprintf("%s|%s|%s\n", levels[v], l.prefix, msg)
 		fmt.Fprintf(w, f, args...)