logging

package
v0.0.0-...-57e6fdc Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLogger

func DefaultLogger() *zap.SugaredLogger

DefaultLogger returns a logger from configuration based on environment variables. If not created default logger, it will creates a new logger and set it to default logger.

func FromContext

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

FromContext returns a logger from given context. If not contained logger from given context, it will return a default logger.

func NewLogger

func NewLogger(develop bool, level string) *zap.SugaredLogger

NewLogger creates a logger with given configuration. If not parse level argument, it will return a logger with info level.

func NewLoggerFromEnv

func NewLoggerFromEnv() *zap.SugaredLogger

NewLoggerFromEnv creates a logger with configuration from environment variables. If not set environment variables, it will return a logger with production mode and info level.

func WithLogger

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger stores a given logger to given context. If context is nil, it will panic. because, this function is wrapper for context.WithValue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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