zerologadapter

package
v4.18.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 3 Imported by: 15

Documentation

Overview

Package zerologadapter provides a logger that writes to a github.com/rs/zerolog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContextFunc added in v4.14.0

func WithContextFunc(withFunc func(context.Context, zerolog.Context) zerolog.Context) option

WithContextFunc adds possibility to get request scoped values from the ctx.Context before logging lines.

func WithoutPGXModule added in v4.14.0

func WithoutPGXModule() option

WithoutPGXModule disables adding module:pgx to the default logger context.

Types

type Logger

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

func NewContextLogger added in v4.14.0

func NewContextLogger(options ...option) *Logger

NewContextLogger creates logger that extracts the zerolog.Logger from the context.Context by using `zerolog.Ctx`. The zerolog.DefaultContextLogger will be used if no logger is associated with the context.

func NewLogger

func NewLogger(logger zerolog.Logger, options ...option) *Logger

NewLogger accepts a zerolog.Logger as input and returns a new custom pgx logging facade as output.

func (*Logger) Log

func (pl *Logger) Log(ctx context.Context, level pgx.LogLevel, msg string, data map[string]interface{})

Jump to

Keyboard shortcuts

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