Documentation ¶
Index ¶
- 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 InDevelopment(opts ...zap.Option)
- func InProduction(opts ...zap.Option)
- func Info(msg string, fields ...zap.Field)
- func Named(s string)
- func Panic(msg string, fields ...zap.Field)
- func Sync() error
- func Warn(msg string, fields ...zap.Field)
- func With(fields ...zap.Field)
- func WithCallerSkip(skip int)
- func WithOptions(opts ...zap.Option)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 InDevelopment ¶
InDevelopment is a reasonable development logging configuration. Logging is enabled at DebugLevel and above.
It enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. StackTraces are automatically included on logs of WarnLevel and above.
func InProduction ¶
InProduction is a reasonable production logging configuration. Logging is enabled at InfoLevel and above.
It uses a JSON encoder, writes to standard error, and enables sampling. StackTraces are automatically included on logs of ErrorLevel and above.
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 ¶
func Named(s string)
Named adds a new path segment to the logger's name. Segments are joined by periods. By default, Loggers are unnamed.
func Panic ¶
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 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.
func With ¶
With creates a child logger and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.
func WithCallerSkip ¶
func WithCallerSkip(skip int)
WithCallerSkip increases the number of callers skipped by caller annotation (as enabled by the AddCaller option).
Types ¶
This section is empty.