gin

package module
v0.0.0-...-7e9762e Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 4 Imported by: 0

README

gorm

Go Reference Go Report Card

A gorm logger implementation.

Usage

import (
    "github.com/mattn/go-sqlite3"
    "github.com/phuslu/log"
    "gorm.io/gorm"
    gormlogger "github.com/phuslu/log-contrib/gorm"
)

func main() {
    newLogger := gormlogger.New(&log.Logger{
        Level:      log.InfoLevel,
        TimeFormat: "15:04:05",
        Caller:     1,
        Writer: &log.ConsoleWriter{
            ColorOutput:    true,
            QuoteString:    false,
            EndWithMessage: false,
        },
    })

    db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{Logger: newLogger})

    // ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger *log.Logger, config logger.Config, slient bool) logger.Interface

Types

This section is empty.

Jump to

Keyboard shortcuts

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