|
|
@ -4,8 +4,6 @@ import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"path" |
|
|
|
|
|
|
|
"runtime" |
|
|
|
|
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
|
"time" |
|
|
|
"time" |
|
|
@ -27,8 +25,8 @@ var patternMap = map[string]func(map[string]interface{}) string{ |
|
|
|
"i": keyFactory(_instanceID), |
|
|
|
"i": keyFactory(_instanceID), |
|
|
|
"e": keyFactory(_deplyEnv), |
|
|
|
"e": keyFactory(_deplyEnv), |
|
|
|
"z": keyFactory(_zone), |
|
|
|
"z": keyFactory(_zone), |
|
|
|
"S": longSource, |
|
|
|
"S": keyFactory(_source), |
|
|
|
"s": shortSource, |
|
|
|
"s": keyFactory(_source), |
|
|
|
"M": message, |
|
|
|
"M": message, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -116,20 +114,6 @@ 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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "unknown:0" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func longTime(map[string]interface{}) string { |
|
|
|
func longTime(map[string]interface{}) string { |
|
|
|
return time.Now().Format("15:04:05.000") |
|
|
|
return time.Now().Format("15:04:05.000") |
|
|
|
} |
|
|
|
} |
|
|
|