This repo is DEPRECATED! Use https://github.com/spacetab-io/logs-gorm-go instead.
Logger fo gorm
Initiate new logger with prefilled logs.Config
and use it to initiate new gorm logger
package main
import (
"time"
"github.com/jinzhu/gorm"
"github.com/microparts/logs-go"
"github.com/microparts/logs-go-gorm"
)
func main() {
// initiate logs-go
conf := &logs.Config{
Level:"warn",
Format: "text",
Sentry: &logs.SentryConfig{
Enable: true,
Stage:"test",
DSN: "http://dsn.sentry.com",
ResponseTimeout: 0,
StackTrace: logs.StackTraceConfig{
Enable: true,
},
},
}
l, err := logs.NewLogger(conf)
if err != nil {
panic(err)
}
db, _ := gorm.Open("sqlite3", "./db.sqlite")
db.SetLogger(gormLogger.NewLogger(l))
db.LogMode(true)
}
The software is provided under MIT Licence.