Merge pull request #205 from bilibili/log/remove-useless-code

remove useless code
pull/212/head
Tony 5 years ago committed by GitHub
commit 9adcdf74af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      pkg/log/pattern.go

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"io" "io"
"path" "path"
"runtime"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -111,16 +110,16 @@ func keyFactory(key string) func(map[string]interface{}) string {
} }
} }
func longSource(map[string]interface{}) string { func longSource(d map[string]interface{}) string {
if _, file, lineNo, ok := runtime.Caller(6); ok { if fn, ok := d[_source].(string); ok {
return fmt.Sprintf("%s:%d", file, lineNo) return fn
} }
return "unknown:0" return "unknown:0"
} }
func shortSource(map[string]interface{}) string { func shortSource(d map[string]interface{}) string {
if _, file, lineNo, ok := runtime.Caller(6); ok { if fn, ok := d[_source].(string); ok {
return fmt.Sprintf("%s:%d", path.Base(file), lineNo) return path.Base(fn)
} }
return "unknown:0" return "unknown:0"
} }

Loading…
Cancel
Save