MCPcopy
hub / github.com/uber-go/zap / Must

Function Must

logger.go:117–123  ·  view source on GitHub ↗

Must is a helper that wraps a call to a function returning (*Logger, error) and panics if the error is non-nil. It is intended for use in variable initialization such as: var logger = zap.Must(zap.NewProduction())

(logger *Logger, err error)

Source from the content-addressed store, hash-verified

115//
116// var logger = zap.Must(zap.NewProduction())
117func Must(logger *Logger, err error) *Logger {
118 if err != nil {
119 panic(err)
120 }
121
122 return logger
123}
124
125// NewExample builds a Logger that's designed for use in zap's testable
126// examples. It writes DebugLevel and above logs to standard out as JSON, but

Callers 3

TestMustFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestMustFunction · 0.68