Skip to content

carlcarl/gorm-logger-logrus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorm-logger-logrus

Logrus logger for gorm v2

package main

import (
  "gorm.io/gorm"
  "gorm.io/driver/sqlite"
  "github.com/nekomeowww/gorm-logger-logrus"
)

func main() {
    db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{
        Logger: gormloggerlogrus.New(gormloggerlogrus.Options{
            Logger:                    logrus.NewEntry(logrus.New()),
            LogLevel:                  gorm.Slient,
            IgnoreRecordNotFoundError: false,
            SlowThreshold:             time.Millisecond * 200,
            FileWithLineNumField:      "file",
        }),
    })
    if err != nil {
        panic("failed to connect database")
    }
}

About

A gorm logrus logger implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%