gormzerolog

package module
v0.0.0-...-0421af8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 7 Imported by: 1

README

gorm-zerolog

Build Status codecov GoDoc license

Alternative logging with zerolog for GORM ⚡️

In comparison to gorm's default logger, gorm-zerolog is faster, reflection free, low allocations and no regex compilations.

Example

package main

import (
	"github.com/jinzhu/gorm"
	"github.com/gorpher/gorm-zerolog"
)

const (
	databaseURL = "postgres://postgres:@localhost/gormzr?sslmode=disable"
)

func main() {
	logger, err = zerolog.NewProduction()
	if err != nil {
		panic(err)
	}

	db, err := gorm.Open("postgres", databaseURL)
	if err != nil {
		panic(err)
	}
	db.LogMode(true)
	db.SetLogger(gorm - zerolog.New(logger))

	// ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggerInterface

func NewLoggerInterface(isDebug bool, args ...int) logger.Interface

NewLoggerInterface level,slowThreshold,skipFrameCount

func WithContextSilent

func WithContextSilent() context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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