Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ServiceKey is zap field key for service. ServiceKey = "service" // ComponentKey is zap field key for component. ComponentKey = "component" // ErrorKey is zap field key for error. ErrorKey = "error" )
Variables ¶
View Source
var NewNopLogger = zap.NewNop
NewNopLogger is alias for zap.NewNop.
Functions ¶
func SyncOnClose ¶
SyncOnClose call log.Sync before run group exit.
Types ¶
type Logger ¶
Logger is type alias for zap.Logger.
func DefaultLogger ¶
DefaultLogger create a default logger, if helpful before logger init.
type Option ¶
type Option struct { // LogLevel is zap logger level. LogLevel string // LogEncoding is zap LogEncoding. LogEncoding string // Caller control if add caller to log. Caller bool // Prod if true use zap production preset. Prod bool // contains filtered or unexported fields }
Option is Logger options.
func (*Option) CreateLogger ¶
CreateLogger create zap logger from self option.
func (*Option) GetLevel ¶
func (opt *Option) GetLevel() zap.AtomicLevel
GetLevel get inner zap AtomicLevel.
Click to show internal directories.
Click to hide internal directories.