Skip to content

Commit 4e8f554

Browse files
committed
Merge branch 'update'
2 parents 6a0fcfb + cd23680 commit 4e8f554

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import (
88
)
99
1010
func init() {
11-
fixByFile := []string{"asm_amd64.s", "proc.go"}
12-
fixByFunc := []string{}
13-
log.Init("debug", fixByFile, fixByFunc)
11+
log.Init("debug")
1412
}
1513
1614
func main() {
1715
log.Infof("Hello ION!")
1816
}
1917
```
2018
## Feature
21-
* GoodFormat: [date time] [Level] [Line][File][Func] => YourLog
19+
GoodFormat:
2220
```
23-
[2020-11-04 16:13:54.593] [INFO] [14][main.go][main] => Hello ION!
21+
[date time][file:line][Level][Func] => YourLog
22+
```
23+
```
24+
[2021-05-01 17:33:47][main.go:12][INFO][main.main] => Hello ION!
2425
```
25-
* FixByHand: you can fixByFile or fixByFunc when you found the log line not right
2626

log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (s *LogFormatter) Format(entry *log.Entry) ([]byte, error) {
122122
len = entry.Caller.Line
123123
}
124124

125-
msg := fmt.Sprintf("[%s][%s:%d][%s][%s] %s\n", timestamp, file, len, strings.ToUpper(entry.Level.String()), getFuncName(entry.Caller.Function), entry.Message)
125+
msg := fmt.Sprintf("[%s][%s:%d][%s][%s] => %s\n", timestamp, file, len, strings.ToUpper(entry.Level.String()), getFuncName(entry.Caller.Function), entry.Message)
126126
return []byte(msg), nil
127127
}
128128

0 commit comments

Comments
 (0)