dblogger

package
v0.0.0-...-455e706 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package logger defines gorm logger

Index

Constants

View Source
const (
	Reset       = "\033[0m"
	Red         = "\033[31m"
	Green       = "\033[32m"
	Yellow      = "\033[33m"
	Blue        = "\033[34m"
	Magenta     = "\033[35m"
	Cyan        = "\033[36m"
	White       = "\033[37m"
	BlueBold    = "\033[34;1m"
	MagentaBold = "\033[35;1m"
	RedBold     = "\033[31;1m"
	YellowBold  = "\033[33;1m"
)

Define colors.

View Source
const (
	Silent gormlogger.LogLevel = iota + 1
	Error
	Warn
	Info
)

Define gorm log levels.

View Source
const NULL = "NULL"

NULL defines a NULL string.

Variables

This section is empty.

Functions

func ExplainSQL

func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string

ExplainSQL explain a SQL. nolint: gocognit,gocyclo

func New

func New(level int) gormlogger.Interface

New create a gorm logger instance.

Types

type Config

type Config struct {
	SlowThreshold time.Duration       //慢阈值
	Colorful      bool                //是否打开颜色输出
	LogLevel      gormlogger.LogLevel //日志等级
}

Config defines a gorm logger configuration.

type Writer

type Writer interface {
	Printf(string, ...interface{})
}

Writer log writer interface.

Jump to

Keyboard shortcuts

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