Documentation ¶
Index ¶
Constants ¶
const ( PrettyEncoding = "pretty" JSONEncoding = "json" )
const ( DebugLevel = zapcore.DebugLevel InfoLevel = zapcore.InfoLevel WarnLevel = zapcore.WarnLevel ErrorLevel = zapcore.ErrorLevel DPanicLevel = zapcore.DPanicLevel PanicLevel = zapcore.PanicLevel FatalLevel = zapcore.FatalLevel )
Variables ¶
var ( Any = zap.Any Array = zap.Array Binary = zap.Binary Bool = zap.Bool Boolp = zap.Boolp Bools = zap.Bools ByteString = zap.ByteString ByteStrings = zap.ByteStrings Complex128 = zap.Complex128 Complex128p = zap.Complex128p Complex128s = zap.Complex128s Complex64 = zap.Complex64 Complex64p = zap.Complex64p Complex64s = zap.Complex64s Duration = zap.Duration Durationp = zap.Durationp Durations = zap.Durations Error = zap.Error Errors = zap.Errors Float32 = zap.Float32 Float32p = zap.Float32p Float32s = zap.Float32s Float64 = zap.Float64 Float64p = zap.Float64p Float64s = zap.Float64s Inline = zap.Inline Int = zap.Int Int16 = zap.Int16 Int16p = zap.Int16p Int16s = zap.Int16s Int32 = zap.Int32 Int32p = zap.Int32p Int32s = zap.Int32s Int64 = zap.Int64 Int64p = zap.Int64p Int64s = zap.Int64s Int8 = zap.Int8 Int8p = zap.Int8p Int8s = zap.Int8s Intp = zap.Intp Ints = zap.Ints NamedError = zap.NamedError Namespace = zap.Namespace Object = zap.Object Reflect = zap.Reflect Skip = zap.Skip Stack = zap.Stack StackSkip = zap.StackSkip String = zap.String Stringer = zap.Stringer Stringp = zap.Stringp Strings = zap.Strings Time = zap.Time Timep = zap.Timep Times = zap.Times Uint = zap.Uint Uint16 = zap.Uint16 Uint16p = zap.Uint16p Uint16s = zap.Uint16s Uint32 = zap.Uint32 Uint32p = zap.Uint32p Uint32s = zap.Uint32s Uint64 = zap.Uint64 Uint64p = zap.Uint64p Uint64s = zap.Uint64s Uint8 = zap.Uint8 Uint8p = zap.Uint8p Uint8s = zap.Uint8s Uintp = zap.Uintp Uintptr = zap.Uintptr Uintptrp = zap.Uintptrp Uintptrs = zap.Uintptrs Uints = zap.Uints )
Re-export of all zap field functions for convenience
var WithCaller = zap.WithCaller
Functions ¶
func DetectBuffering ¶
DetectBuffering detects both if an override is set with PS_LOG_BUFFERED, and what the override says. The common case would be to entirely disable buffering, and simply setting PS_LOG_BUFFERED=0 would explicitly disable it.
func DetectEncoding ¶
func DetectEncoding() string
DetectEncoding detects the encoding to use based on PS_DEV_MODE env var.
func NewPrettyEncoder ¶
func NewPrettyEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
Types ¶
type Config ¶
type Config struct { Level zap.AtomicLevel Encoding string Buffered bool NanoTime bool }
Config is our logging configration
func NewPlanetScaleConfig ¶
NewPlanetScaleConfig creates a zap.Config with the desired encoding and Level.
func NewPlanetScaleConfigDefault ¶
func NewPlanetScaleConfigDefault() Config
NewPlanetScaleConfigDefault creates an opinionated zap.Config while detecting encoding and Level.
type Level ¶
func DetectLevel ¶
func DetectLevel() Level
DetectLevel returns a the Level based on PS_LOG_LEVEL env var.
func ParseLevel ¶
ParseLevel parses a level based on the lower-case or all-caps ASCII representation of the log level. If the provided ASCII representation is invalid an error is returned.
This is particularly useful when dealing with text input to configure log levels.
This is vendored out of `zapcore` since it's added in newer versions, so it's trivial enough to vendor and not require a newer `zap` module.
type Logger ¶
func New ¶
func New() *Logger
New creates a new default PlanetScale Logger with auto detection of level.
func NewAtLevel ¶
NewAtLevel creates a new PlanetScale Logger at the desired Level.
func NewPlanetScaleLogger ¶
func NewPlanetScaleLogger() *Logger
NewPlanetScaleLogger creates an opinionated zap.Logger. Additional customization is available by passing in one or more zap.Options.
func NewPlanetScaleLoggerAtLevel ¶
NewPlanetScaleLoggerAtLevel creates an opinionated Logger at a desired Level.
type SlackGoAdapter ¶
type SlackGoAdapter struct {
// contains filtered or unexported fields
}
func NewSlackGoAdapter ¶
func NewSlackGoAdapter(zl *zap.Logger) *SlackGoAdapter
NewSlackGoAdapter is a wrapper around a zap.Logger that implements the slack.Logger interface for the github.com/slack-go/slack package.
type SugaredLogger ¶
type SugaredLogger = zap.SugaredLogger
func NewPlanetScaleSugarLogger ¶
func NewPlanetScaleSugarLogger() *SugaredLogger
NewPlanetScaleSugarLogger creates an opinionated zap.SugaredLogger. Additional customization is available by passing in one or more zap.Options. NOTE: A SugaredLogger can be converted into a zap.Logger with the .DeSugar() method.
type TemporalAdapter ¶
type TemporalAdapter struct {
// contains filtered or unexported fields
}
func NewTemporalAdapter ¶
func NewTemporalAdapter(zl *zap.Logger) *TemporalAdapter
NewTemporalAdapter wraps a *zap.Logger to implement the temporal.Logger interface.
func (*TemporalAdapter) Debug ¶
func (log *TemporalAdapter) Debug(msg string, keyvals ...interface{})
Debug level log message.
func (*TemporalAdapter) Error ¶
func (log *TemporalAdapter) Error(msg string, keyvals ...interface{})
Error level log message.
func (*TemporalAdapter) Info ¶
func (log *TemporalAdapter) Info(msg string, keyvals ...interface{})
Info level log message.
func (*TemporalAdapter) Warn ¶
func (log *TemporalAdapter) Warn(msg string, keyvals ...interface{})
Warn level log message.