logrm

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

logrm

Build gorm logger with klog klog logger for gorm v2

package
import (
    "context"

    log "github.com/kunstack/klog"

    "github.com/kunstack/logrm"
)

func main() {
    defer log.Flush()
    l := logrm.New()
    l.Info(context.Background(), "this is info message")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() logger.Interface

New Create Logger instance

Types

type Logger

type Logger struct{}

Logger A structure that implements gorm logger.Interface

func (*Logger) Error

func (g *Logger) Error(ctx context.Context, s string, i ...interface{})

Error Print error log

func (*Logger) Info

func (g *Logger) Info(ctx context.Context, s string, i ...interface{})

Info Print information level log

func (*Logger) LogMode

func (g *Logger) LogMode(level logger.LogLevel) logger.Interface

LogMode You cannot change the log level by calling LogMode You can only change the display level of the log through klog

func (*Logger) Trace

func (g *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

Trace Print gorm sql detailed log

func (*Logger) Warn

func (g *Logger) Warn(ctx context.Context, s string, i ...interface{})

Warn Print Warn log

Jump to

Keyboard shortcuts

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