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)
| 115 | // |
| 116 | // var logger = zap.Must(zap.NewProduction()) |
| 117 | func 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 |
no outgoing calls