Skip to content

Commit

Permalink
fix: console ts with json number (rs#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
elvizlai authored and rs committed Nov 12, 2018
1 parent 8e30c71 commit 7bcaa1a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion console.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,16 @@ func colorize(s interface{}, c int, disabled bool) string {
var (
consoleDefaultFormatTimestamp = func(i interface{}) string {
t := "<nil>"
if tt, ok := i.(string); ok {
switch tt := i.(type) {
case string:
ts, err := time.Parse(time.RFC3339, tt)
if err != nil {
t = tt
} else {
t = ts.Format(consoleTimeFormat)
}
case json.Number:
t = tt.String()
}
return colorize(t, colorFaint, consoleNoColor)
}
Expand Down

0 comments on commit 7bcaa1a

Please sign in to comment.