logger

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(opts ...Option) gormlogger.Interface

Logger creates a custom GORM logger tailored to this library's use case.

See With* prefixed Option helpers for further customization. Those can be provided via variadic opts.

Types

type Option added in v1.6.0

type Option = func(c *logger)

Option is the return type for this module's With* prefixed option helpers.

Those can be provided to Logger in order to customize its behavior.

func WithIgnoreNotFoundError added in v1.6.0

func WithIgnoreNotFoundError(v bool) Option

WithIgnoreNotFoundError allows one to avoid reporting "gorm database error" log entries.

It defaults to true (not reporting those entries).

func WithLogLevel added in v1.6.0

func WithLogLevel(v gormlogger.LogLevel) Option

WithLogLevel customizes the maximum level at which the GORM system will be allowed to report its log entries. Logs entries below this level are ignored.

It defaults to gormlogger.Warn.

func WithSlowSqlThreshold added in v1.6.0

func WithSlowSqlThreshold(v time.Duration) Option

WithSlowSqlThreshold customizes a query's elapsed duration after which our logger will start to emit "slow sql" log entries.

Use 0 to disable this feature.

It defaults to 500ms when unspecified.

Jump to

Keyboard shortcuts

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