Skip to content

Commit

Permalink
Separated long and short file names
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Mar 22, 2016
1 parent 72b840d commit 8d26066
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (

var (
global = New("-")
defaultFormat = "time=${time_rfc3339}, level=${level}, prefix=${prefix}, file=${file}, " +
defaultFormat = "time=${time_rfc3339}, level=${level}, prefix=${prefix}, file=${short_file}, " +
"line=${line}, ${message}\n"
)

Expand Down Expand Up @@ -268,7 +268,9 @@ func (l *Logger) log(v uint8, format string, args ...interface{}) {
return w.Write([]byte(l.levels[v]))
case "prefix":
return w.Write([]byte(l.prefix))
case "file":
case "long_file":
return w.Write([]byte(file))
case "short_file":
return w.Write([]byte(path.Base(file)))
case "line":
return w.Write([]byte(strconv.Itoa(line)))
Expand Down

0 comments on commit 8d26066

Please sign in to comment.