logger

package
v0.0.0-...-d5dcd45 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logger provides a wrapper for the zap logger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context, l *zap.Logger) context.Context

ContextWithLogger adds logger to context.

func FromContext

func FromContext(ctx context.Context) *zap.Logger

FromContext returns logger from context.

func FromRequest

func FromRequest(c *gin.Context) *zap.Logger

FromRequest returns logger from request.

func FromRequestToContext

func FromRequestToContext(c *gin.Context) context.Context

FromRequestToContext sets logger from request to context.

func New

func New(console io.Writer, opts ...Option) *zap.Logger

New creates a new logger.

func RequestWithLogger

func RequestWithLogger(c *gin.Context, l *zap.Logger)

RequestWithLogger adds logger to request.

Types

type Level

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

Level is a logger level.

func NewLevel

func NewLevel(lvl string) Level

NewLevel creates a new logger level.

func (Level) ZapLevel

func (l Level) ZapLevel() zapcore.Level

ZapLevel returns the zap level.

type Option

type Option func(*Level)

Option is a function that can be passed to New to customize the logger.

func WithLevel

func WithLevel(lvl string) Option

WithLevel option sets the log level.

Jump to

Keyboard shortcuts

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