Skip to content

Commit

Permalink
improve documentation about timestamp format
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bariod committed Mar 8, 2021
1 parent f104497 commit 7a997b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions json_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func (f FieldMap) resolve(key fieldKey) string {
// JSONFormatter formats logs into parsable json
type JSONFormatter struct {
// TimestampFormat sets the format used for marshaling timestamps.
// The format to use is the same than for time.Format or time.Parse from the standard
// library.
// The standard Library already provides a set of predefined format.
TimestampFormat string

// DisableTimestamp allows disabling automatic timestamps in output
Expand Down
5 changes: 4 additions & 1 deletion text_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ type TextFormatter struct {
// the time passed since beginning of execution.
FullTimestamp bool

// TimestampFormat to use for display when a full timestamp is printed
// TimestampFormat to use for display when a full timestamp is printed.
// The format to use is the same than for time.Format or time.Parse from the standard
// library.
// The standard Library already provides a set of predefined format.
TimestampFormat string

// The fields are sorted by default for a consistent output. For applications
Expand Down

0 comments on commit 7a997b9

Please sign in to comment.