logging

package
v0.0.0-...-f5345f4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelKey  = "level"
	FormatKey = "format"
)
View Source
const (
	LoggerKey = "logger"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

func Error

func Error(msg string, fields ...zap.Field)

func Fatal

func Fatal(msg string, fields ...zap.Field)

func Info

func Info(msg string, fields ...zap.Field)

func Named

func Named(s string) *zap.Logger

func Panic

func Panic(msg string, fields ...zap.Field)

func Warn

func Warn(msg string, fields ...zap.Field)

func With

func With(fields ...zap.Field) *zap.Logger

func WithOptions

func WithOptions(opts ...zap.Option) *zap.Logger

Types

type Config

type Config struct {
	config.PrintableInfoConfig

	// "debug", "info", "warn", "error", "dpanic", "panic", and "fatal"
	Level string
	// "console" and json
	Format string
	// "dispatcher", "provider", etc
	Name string
	// map[string]interface{}{"foo": 1, "bar": 2}
	Payloads   map[string]interface{}
	StackTrace bool
}

func (*Config) PrintInfo

func (config *Config) PrintInfo()

func (*Config) ToZapConfig

func (config *Config) ToZapConfig() (*zap.Config, error)

type Logger

type Logger struct {
	*zap.Logger
}

func Default

func Default() (*Logger, error)

Init default logger

func Init

func Init(config *Config) (*Logger, error)

Init logger from config

func LoggerFromContext

func LoggerFromContext(ctx context.Context) *Logger

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Named

func (l *Logger) Named(s string) *Logger

func (*Logger) ToContext

func (l *Logger) ToContext(ctx context.Context) context.Context

Jump to

Keyboard shortcuts

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