package zerologadapter
import "github.com/jackc/pgx/v4/log/zerologadapter"
Package zerologadapter provides a logger that writes to a github.com/rs/zerolog.
Index ¶
- func WithContextFunc(withFunc func(context.Context, zerolog.Context) zerolog.Context) option
- func WithoutPGXModule() option
- type Logger
Functions ¶
func WithContextFunc ¶
WithContextFunc adds possibility to get request scoped values from the ctx.Context before logging lines.
func WithoutPGXModule ¶
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 ¶
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 ¶
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{})
Source Files ¶
- Version
- v4.17.0
- Published
- Aug 6, 2022
- Platform
- js/wasm
- Imports
- 3 packages
- Last checked
- 41 minutes ago –
Tools for package owners.