Documentation ¶
Index ¶
- Constants
- func DPanic(args ...interface{})
- func DPanicf(template string, args ...interface{})
- func DPanicw(msg string, keysAndValues ...interface{})
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Desugar() *zap.Logger
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Named(name string) *zap.SugaredLogger
- func NewConfig(c *ZapConfig) (*zapConfig, error)
- func NewLogWriter() io.Writer
- func NewLogWriterWithLevel(lv level) io.Writer
- func NewLogger(c *zapConfig) *zap.Logger
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func SetDevelopment()
- func SetEncoder(ec encoder)
- func SetLevel(l level)
- func SetStackLevel(l level)
- func SetTimeEncoding(tec timeEncoding)
- func Sync() error
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type ZapConfig
Constants ¶
const ( LevelDebug level = "debug" LevelInfo level = "info" LevelWarn level = "warn" LevelError level = "error" LevelPanic level = "panic" )
const ( EncoderConsole encoder = "console" EncoderJSON encoder = "json" )
const ( TimeEncodingISO8601 timeEncoding = "iso8601" TimeEncodingMillis timeEncoding = "millis" TimeEncodingNanos timeEncoding = "nano" TimeEncodingEpoch timeEncoding = "epoch" TimeEncodingDefault timeEncoding = "default" )
Variables ¶
This section is empty.
Functions ¶
func DPanic ¶
func DPanic(args ...interface{})
DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)
func DPanicf ¶
func DPanicf(template string, args ...interface{})
DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)
func DPanicw ¶
func DPanicw(msg string, keysAndValues ...interface{})
DPanicw logs a message with some additional context. In development, the logger then panics. (See DPanicLevel for details.) The variadic key-value pairs are treated as they are in With.
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
When debug-level logging is disabled, this is much faster than
s.With(keysAndValues).Debug(msg)
func Desugar ¶
Desugar unwraps a SugaredLogger, exposing the original Logger. Desugaring 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 Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Errorw ¶
func Errorw(msg string, keysAndValues ...interface{})
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func Fatalw ¶
func Fatalw(msg string, keysAndValues ...interface{})
Fatalw logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func Infow ¶
func Infow(msg string, keysAndValues ...interface{})
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func Named ¶
func Named(name string) *zap.SugaredLogger
Named adds a sub-scope to the logger's name. See Logger.Named for details.
func NewLogWriter ¶ added in v0.0.4
func NewLogWriterWithLevel ¶ added in v0.0.4
func Panic ¶
func Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
func Panicf ¶
func Panicf(template string, args ...interface{})
Panicf uses fmt.Sprintf to log a templated message, then panics.
func Panicw ¶
func Panicw(msg string, keysAndValues ...interface{})
Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.
func SetDevelopment ¶ added in v0.0.3
func SetDevelopment()
func SetEncoder ¶
func SetEncoder(ec encoder)
func SetStackLevel ¶
func SetStackLevel(l level)
func SetTimeEncoding ¶
func SetTimeEncoding(tec timeEncoding)
Types ¶
type ZapConfig ¶
type ZapConfig struct { Development bool `json:"development,omitempty" yaml:"development,omitempty"` Encoder encoder `json:"encoder,omitempty" yaml:"encoder,omitempty"` Level level `json:"level,omitempty" yaml:"level,omitempty"` StackLevel level `json:"stack_level,omitempty" yaml:"stack_level,omitempty"` Sample bool `json:"sample,omitempty" yaml:"sample,omitempty"` TimeEncoding timeEncoding `json:"time_encoding,omitempty" yaml:"time_encoding,omitempty"` }