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
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

This comment has been minimized.

Copy link
@reversekick

reversekick Mar 8, 2021

Why are we not explicit? and mention
Note: Standard library expects a particular date string value used while formatting i.e. "2006-01-02 15:04:05" that should be strictly followed - you cannot have any other value here. Please refer to standard library time.Format/time.Parse for the details.

This comment has been minimized.

Copy link
@dgsb

dgsb Mar 9, 2021

Collaborator

This is a very well known standard library API, I don't think we need to add anything more here.

// 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
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.