yaglogger_gorm

package module
v0.0.0-...-54243cd Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 8 Imported by: 0

README

Yaglogger wrapper for Gorm

This wrapper allows for easy usage of YagLogger with Gorm. Ensuring all can be used via the same logger.

This is a different package than the normal YagLogger package to ensure the dependencies of the original logger package is small as possible.

example usage:

import (
    "gorm.io/driver/postgres"
    "gorm.io/gorm"
    "github.com/jlentink/yaglogger"
    yagloggerGorm "github.com/jlentink/yaglogger-gorm"
)

db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{Logger: .NewLogger()})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogWrapper

type LogWrapper struct {
	IgnoreRecordNotFoundError bool
	SlowThreshold             time.Duration
	SilenceQueries            bool
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger() LogWrapper

func (LogWrapper) Error

func (l LogWrapper) Error(_ context.Context, msg string, args ...interface{})

func (LogWrapper) Info

func (l LogWrapper) Info(_ context.Context, msg string, args ...interface{})

func (LogWrapper) LogMode

func (l LogWrapper) LogMode(level logger.LogLevel) logger.Interface

func (LogWrapper) Trace

func (l LogWrapper) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (LogWrapper) Warn

func (l LogWrapper) Warn(_ context.Context, msg string, args ...interface{})

Jump to

Keyboard shortcuts

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