Skip to content

Add SetFlags to customize the format for the messages - #18

Merged
pkern merged 1 commit into
google:masterfrom
cixtor:master
Nov 12, 2018
Merged

Add SetFlags to customize the format for the messages#18
pkern merged 1 commit into
google:masterfrom
cixtor:master

Conversation

@cixtor

@cixtor cixtor commented Nov 11, 2018

Copy link
Copy Markdown
Contributor

These flags define which text to prefix to each log entry generated by the Logger.

Bits are or'ed together to control what's printed. There is no control over the order they appear (the order listed here) or the format they present (as described in the comments). The prefix is followed by a colon only when Llongfile or Lshortfile is specified. For example:

log.SetFlags(LstdFlags)
// -> 2009/01/23 01:23:23 message

log. SetFlags(Ldate | Ltime)
// -> 2009/01/23 01:23:23 message

log.SetFlags(Ldate | Ltime | Lmicroseconds | Llongfile)
// -> 2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message

More info: https://golang.org/pkg/log/#pkg-constants

@pkern pkern left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants