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

Loading…
Cancel
Save