forked from blendle/zapdriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
39 lines (30 loc) · 1.25 KB
/
logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package zapdriver
import (
"go.uber.org/zap"
)
// NewProduction builds a sensible production Logger that writes InfoLevel and
// above logs to standard error as JSON.
//
// It's a shortcut for NewProductionConfig().Build(...Option).
func NewProduction(options ...zap.Option) (*zap.Logger, error) {
options = append(options, WrapCore())
return NewProductionConfig().Build(options...)
}
// NewProductionWithCore is same as NewProduction but accepts a custom configured core
func NewProductionWithCore(core zap.Option, options ...zap.Option) (*zap.Logger, error) {
options = append(options, core)
return NewProductionConfig().Build(options...)
}
// NewDevelopment builds a development Logger that writes DebugLevel and above
// logs to standard error in a human-friendly format.
//
// It's a shortcut for NewDevelopmentConfig().Build(...Option).
func NewDevelopment(options ...zap.Option) (*zap.Logger, error) {
options = append(options, WrapCore())
return NewDevelopmentConfig().Build(options...)
}
// NewDevelopmentWithCore is same as NewDevelopment but accepts a custom configured core
func NewDevelopmentWithCore(core zap.Option, options ...zap.Option) (*zap.Logger, error) {
options = append(options, core)
return NewDevelopmentConfig().Build(options...)
}