xslog

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package xslog provide some helper for slog package.

  1. NewContext & FromContext 1.1 slog didn't provide machinism for pass logger with context, see https://github.com/golang/go/issues/56345#issuecomment-1379438240 and https://github.com/golang/go/issues/56345#issuecomment-1401382937 for more detail

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

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

FromContext returns the Logger stored in ctx by NewContext, or the default Logger if there is none.

func NewContext

func NewContext(ctx context.Context, l *slog.Logger) context.Context

NewContext returns a context that contains the given Logger. Use FromContext to retrieve the Logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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