log

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package log provides methods for creating the logger

Index

Constants

View Source
const (
	// ContextLogger is the context logger key.
	ContextLogger = ContextKey("logger")
)

Variables

This section is empty.

Functions

func FromContext

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

FromContext gets the logger from the given context.

func NewLogger

func NewLogger(level string, mode string) *zap.Logger

NewLogger creates a zap logger based on the mode you specify, defaulting to production if no mode was matched.

func SetContext

func SetContext(ctx context.Context, contextLogger *zap.Logger) context.Context

SetContext sets the given logger in a new child context.

Types

type ContextKey

type ContextKey string

ContextKey is the context key type.

Jump to

Keyboard shortcuts

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