Documentation ¶
Index ¶
- func Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry
- func Core() zapcore.Core
- func DPanic(msg string, fields ...zap.Field)
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func Fatal(msg string, fields ...zap.Field)
- func Info(msg string, fields ...zap.Field)
- func Named(s string) *zap.Logger
- func Panic(msg string, fields ...zap.Field)
- func SetLogger(logger *zap.Logger)
- func Sugar() *zap.SugaredLogger
- func Sync() error
- func Warn(msg string, fields ...zap.Field)
- func With(fields ...zap.Field) *zap.Logger
- func WithOptions(opts ...zap.Option) *zap.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry
Check returns a CheckedEntry if logging a message at the specified level is enabled. It's a completely optional optimization; in high-performance applications, Check can help avoid allocating a slice to hold fields.
func DPanic ¶
DPanic logs a message at DPanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
If the logger is in development mode, it then panics (DPanic means "development panic"). This is useful for catching errors that are recoverable, but shouldn't ever happen.
func Debug ¶
Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.
func Info ¶
Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Named ¶
Named adds a new path segment to the logger's name. Segments are joined by periods. By default, Loggers are unnamed.
func Panic ¶
Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then panics, even if logging at PanicLevel is disabled.
func Sugar ¶
func Sugar() *zap.SugaredLogger
Sugar wraps the Logger to provide a more ergonomic, but slightly slower, API. Sugaring a Logger is quite inexpensive, so it's reasonable for a single application to use both Loggers and SugaredLoggers, converting between them on the boundaries of performance-sensitive code.
func Sync ¶
func Sync() error
Sync calls the underlying Core's Sync method, flushing any buffered log entries. Applications should take care to call Sync before exiting.
func Warn ¶
Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
Types ¶
This section is empty.