8000 GitHub - truongkma/gormzerolog
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

truongkma/gormzerolog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zero Allocation JSON Logger for GORM

This package supports the use of Zerolog with Gorm

Usage

package main

import (
	"time"

	"github.com/truongkma/gormzerolog"
	"gorm.io/driver/postgres"
	"gorm.io/gorm"
)

func main() {
	logger := gormzerolog.NewLogger(gormzerolog.Config{
		SlowThreshold:        time.Second,
		ParameterizedQueries: true,
	})

	dsn := "host=localhost user=postgres password=postgres dbname=gorm port=5432 sslmode=disable TimeZone=Asia/Shanghai"

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0