logx

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

  • @Author: reel
  • @Date: 2023-08-14 20:39:55
  • @LastEditors: reel

<<<<<<< HEAD

  • @LastEditTime: 2023-08-16 21:28:17

=======

  • @LastEditTime: 2024-01-14 17:38:07

>>>>>>> develop

  • @Description: 适用于gorm的logger

  • @Author: reel

  • @Date: 2023-06-04 22:37:35

  • @LastEditors: reel

  • @LastEditTime: 2023-08-15 22:53:03

  • @Description: 请填写简介

  • @Author: reel

  • @Date: 2023-05-11 22:27:38

  • @LastEditors: reel

  • @LastEditTime: 2023-08-14 21:13:47

  • @Description: 请填写简介

Index

Constants

This section is empty.

Variables

View Source
var (
	Sys Logger
	DB  *gormLogger
	APP Logger
)

Functions

func Close

func Close()

func Details

func Details(mags map[string]interface{}) infoFunc

func E

func E(err error) infoFunc

func EV

func EV(err error) infoFunc

func F

func F(key string, value interface{}) infoFunc

func Init

func Init(optF ...optFunc) (err error)

仅用于日志路径的设置, 请不要设置日志名称

func NewGormLogger

func NewGormLogger(optF ...optFunc) (*gormLogger, error)

func SetDataPath

func SetDataPath(dataPath string) optFunc

设置日志存储目录

func SetLevel

func SetLevel(level logrus.Level) optFunc

设置 日志级别

func SetLogMaxage

func SetLogMaxage(logMaxage time.Duration) optFunc

设置最大保存时间

func SetLogName

func SetLogName(logName string) optFunc

设置日志名称

func SetLogPath

func SetLogPath(logPath string) optFunc

设置日志路径

func SetLogRotationTime

func SetLogRotationTime(logRotationTime time.Duration) optFunc

设置覆盖时间

func SetLogSlowThreshold

func SetLogSlowThreshold(t time.Duration) optFunc

设置慢查询时间

func SetTimestampFormat

func SetTimestampFormat(timestampFormat string) optFunc

设置时间格式

Types

type Logger

type Logger interface {
	Close()
	Debug(msg string, infoF ...infoFunc)
	Info(msg string, infoF ...infoFunc)
	Warn(msg string, infoF ...infoFunc)
	Error(msg string, infoF ...infoFunc)
	Fatal(msg string, infoF ...infoFunc)
	// contains filtered or unexported methods
}

func New

func New(optF ...optFunc) (Logger, error)

Jump to

Keyboard shortcuts

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