gorm_logger

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(wr io.Writer, opts ...Options) logger.Interface

New use given writer as the target where the log for GORM is written to. Also apply the provided various available options.

Types

type Options

type Options func(*logger.Config)

func WithColor

func WithColor() Options

WithColor set the GORM log to be colorful.

func WithIgnoreRecordNotFound

func WithIgnoreRecordNotFound() Options

WithIgnoreRecordNotFound shutdown the error record not found, because by default GORM will throw error on record not found.

func WithLogLevel

func WithLogLevel(lvl int) Options

WithLogLevel set the GORM's logger log level. Should be set as follows

1: Silent
2: Error (only log error query)
3: Warn (include warning query)
4: Info (most verbose)

func WithThreshold

func WithThreshold(dur int) Options

WithThreshold set the duration of GORM's operation that's regarded as slow operation in milliseconds.

Jump to

Keyboard shortcuts

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