log

package
v0.0.0-...-f1d22f6 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package log is copied from gorm.Logger and add traceId

Index

Constants

This section is empty.

Variables

View Source
var ErrRecordNotFound = errors.New("record not found")

ErrRecordNotFound record not found error

View Source
var Logger = logrus.New()

Functions

func FormatTraceIdIfExist

func FormatTraceIdIfExist(entry *logrus.Entry) string

func Init

func Init()

func MethodColor

func MethodColor(method string) string

func NewGormLogger

func NewGormLogger(level LogLevel) gormLogger.Interface

NewGormLogger initialize gormTraceLogger

func StatusCodeColor

func StatusCodeColor(code int) string

Types

type Config

type Config struct {
	SlowThreshold             time.Duration
	IgnoreRecordNotFoundError bool
	LogLevel                  LogLevel
}

Config gormTraceLogger config

type Formatter

type Formatter struct{}

func (Formatter) Format

func (f Formatter) Format(entry *logrus.Entry) ([]byte, error)

type LogLevel

type LogLevel uint
const (
	// Silent silent log level
	Silent LogLevel = iota + 1
	// Error error log level
	Error
	// Warn warn log level
	Warn
	// Info info log level
	Info
)

Jump to

Keyboard shortcuts

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