logger

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 7 Imported by: 39

Documentation

Overview

Package logger contains helpers for logging. This is mostly thin wrappers around the zap logging package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(level string) (*zap.SugaredLogger, error)

Build builds a logger with the specified log level.

func Get

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

Get returns the logger in context, if there is one. If there isn't, it returns the global logger.

func Middleware

func Middleware(l *zap.Logger) func(next http.Handler) http.Handler

Middleware is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was, and how long it took to return.

func Set added in v0.4.0

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

Set the logger in the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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