소스 검색

Merge pull request #1 from mattn/fix-crash

Fix crash
Vishal Rana 10 년 전
부모
커밋
e1ed10edce
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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...)