-
Notifications
You must be signed in to change notification settings - Fork 115
Conversation
current time format is |
return nil | ||
} | ||
|
||
// LogSetupError output error log with log package and exit immediately. | ||
func LogSetupError(err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogSetupFatal()
looks better to me than LogSetupError()
.
@kazegusuri How is the progress? |
Remove WIP from title, please take a look. |
) | ||
|
||
func init() { | ||
LogAccess = zap.New(zap.NewJSONEncoder(zap.RFC3339Formatter("time")), zap.DiscardOutput) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify time format, please.
- package: github.com/mercari/gcm | ||
version: 987b1dc4ce9034b698395d35de1aadf999388b8f | ||
- package: github.com/fukata/golang-stats-api-handler | ||
version: e7ee1630fdb679c86ec8e3d0755e3576675fdb10 | ||
- package: github.com/stretchr/testify | ||
version: v1.1.3 | ||
- package: github.com/uber-go/zap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify version of zap.
use github.com/uber-go/zap instead of github.com/Sirupsen/logrus for access/error logs. This breaks compatibility about log format and achieves fully json logging.
zap is very complex to use (ex: omitempty), but slightly faster than other loggers. This is a benchmark before/after this changes for
gaurun.LogPush
.before
after
2 allocs for zap logging. 2 allocs for
ptime
's format conversion.EDIT:
After removing format conversion and computing the value instead.
change list
[info] {"message": "...", ...}
to{"level":"info","message":"..."...}
2015/08/04 15:32:35 JST
(local time) to2016-08-30T01:18:04Z
(UTC)