Documentation ¶
Index ¶
- func ConfigureDevLogger() *zap.Logger
- func ConfigureProdLogger() *zap.Logger
- func ConfigureZapGlobals()
- func ImbueContext(ctx context.Context, logger *zap.Logger) context.Context
- func L(ctx context.Context, opts ...zap.Option) *zap.Logger
- func MakeFieldsUnique(reorderLoggedFields bool) zap.Option
- func NewPrettyConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func SL(ctx context.Context, opts ...zap.Option) *zap.SugaredLogger
- func TryGetLoggerFromContext(ctx context.Context) *zap.Logger
- func WithFields(ctx context.Context, fields ...zap.Field) context.Context
- type MemorySink
- type ShortenedStackTrace
- type StackElement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureDevLogger ¶
func ConfigureProdLogger ¶
func ConfigureZapGlobals ¶
func ConfigureZapGlobals()
func MakeFieldsUnique ¶
func NewPrettyConsoleEncoder ¶
func NewPrettyConsoleEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewPrettyConsoleEncoder creates an encoder whose output is designed for human - rather than machine - consumption. It serializes the core log entry data (message, level, timestamp, etc.) in a plain-text format and leaves the structured context as a pretty-printed multiline JSON.
Additional functionality includes easily-readable stack traces.
Note that while pretty-printing is useful in development, it's bad for production
Types ¶
type MemorySink ¶
MemorySink implements zap.Sink by writing all messages to a buffer.
func NewMemorySinkLogger ¶
func NewMemorySinkLogger() (*MemorySink, *zap.Logger)
func (*MemorySink) Close ¶
func (s *MemorySink) Close() error
func (*MemorySink) Sync ¶
func (s *MemorySink) Sync() error
type ShortenedStackTrace ¶
type ShortenedStackTrace struct {
// contains filtered or unexported fields
}
func NewShortenedStackTrace ¶
func NewShortenedStackTrace(skipFrames int, skipToFirstPanic bool, msg interface{}) *ShortenedStackTrace
NewShortenedStackTrace creates a new shortened stack trace, that can optionally skip all the frames after the first panic() call (typically deferred error handlers).
func (*ShortenedStackTrace) Error ¶
func (s *ShortenedStackTrace) Error() string
func (*ShortenedStackTrace) Field ¶
func (s *ShortenedStackTrace) Field() zap.Field
func (*ShortenedStackTrace) JSONStack ¶
func (s *ShortenedStackTrace) JSONStack() []StackElement
JSONStack creates a nice stack trace, skipping all the deferred frames after the first panic() call. This method returns the list of structures that can be nicely reflected into JSON.
func (*ShortenedStackTrace) StackTrace ¶
func (s *ShortenedStackTrace) StackTrace() []uintptr
func (*ShortenedStackTrace) StringStack ¶
func (s *ShortenedStackTrace) StringStack() string
StringStack creates a nice stack trace, skipping all the deferred frames after the first panic() call. This method returns a human-readable multi-line string.