zaplogger

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package zap_logger provides an implementation of the Yall logger interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(name string, opts ...LoggerOpt) (yall.Logger, error)

NewLogger creates a new Logger, configured with the passed LoggerOpt args By default, with no options, the logger is configured for development.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is just a thin wrapper around a sugared zap logger with some opinionated defaults.

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Debugnc

func (l *Logger) Debugnc(msg string, keysAndValues ...interface{})

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Errornc

func (l *Logger) Errornc(msg string, keysAndValues ...interface{})

func (*Logger) ExecutionIDFrom

func (l *Logger) ExecutionIDFrom(ctx context.Context) string

ExecutionIDFrom retrieves the execution id from the given context, if present.

func (*Logger) Fatal

func (l *Logger) Fatal(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Fatalnc

func (l *Logger) Fatalnc(msg string, keysAndValues ...interface{})

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Infonc

func (l *Logger) Infonc(msg string, keysAndValues ...interface{})

func (*Logger) Panic

func (l *Logger) Panic(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Panicnc

func (l *Logger) Panicnc(msg string, keysAndValues ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, keysAndValues ...interface{})

func (*Logger) Warnnc

func (l *Logger) Warnnc(msg string, keysAndValues ...interface{})

func (*Logger) With

func (l *Logger) With(args ...interface{}) yall.Logger

type LoggerOpt

type LoggerOpt func(opts *loggerConf) *loggerConf

func Production

func Production() LoggerOpt

Production uses a zap production config, with ISO 8601 timestamps.

func WithExecutionIDContextKey

func WithExecutionIDContextKey(requestIDContextKey interface{}) LoggerOpt

WithExecutionIDContextKey configures the key to use to extract execution id from context.

func WithExecutionIDKey

func WithExecutionIDKey(requestIDKey string) LoggerOpt

WithExecutionIDKey sets the key to use to log the execution id.

func WithNameKey

func WithNameKey(nameKey string) LoggerOpt

WithNameKey configures the key to use for the logger's name.

func WithOmitExecutionIDWhenMissing

func WithOmitExecutionIDWhenMissing() LoggerOpt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL