Skip to content

Commit

Permalink
log file index out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
abericyang@gmail.com committed Sep 19, 2019
1 parent e758bba commit a68cd35
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion log.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@ func (l *LogCommon) logStandard(file, levelName, msg string, line int, ok bool,
zoneName, _ = timeNow.Local().Zone()
}
timeString = strings.Join([]string{timeString, zoneName}, " ")
fileString = strings.Split(strings.Join([]string{file, strconv.Itoa(line)}, ":"), "/go/src/")[1]
logArr := strings.Split(strings.Join([]string{file, strconv.Itoa(line)}, ":"), "/go/src/")
if len(logArr) > 1 {
fileString = logArr[1]
} else {
fileString = logArr[0]
}
if !l.production {
var (
commandJSON []byte
Expand Down

0 comments on commit a68cd35

Please sign in to comment.