utils

package
v0.0.0-...-97a7533 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelError 错误
	LevelError = iota
	// LevelWarning 警告
	LevelWarning
	// LevelInformational 提示
	LevelInformational
	// LevelDebug 除错
	LevelDebug
)

Variables

This section is empty.

Functions

func BuildLogger

func BuildLogger(level string)

BuildLogger 构建logger

func RandStringRunes

func RandStringRunes(n int) string

RandStringRunes 返回随机字符串

func SetToken

func SetToken(username string, Id uint) (string, error)

生成token

func Start_log

func Start_log()

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger 日志

func Log

func Log() *Logger

Log 返回日志对象

func (*Logger) Debug

func (ll *Logger) Debug(format string, v ...interface{})

Debug 校验

func (*Logger) Error

func (ll *Logger) Error(format string, v ...interface{})

Error 错误

func (*Logger) Info

func (ll *Logger) Info(format string, v ...interface{})

Info 信息

func (*Logger) Panic

func (ll *Logger) Panic(format string, v ...interface{})

Panic 极端错误

func (*Logger) Println

func (ll *Logger) Println(msg string)

Println 打印

func (*Logger) Warning

func (ll *Logger) Warning(format string, v ...interface{})

Warning 警告

type MyClaims

type MyClaims struct {
	Username string `json:"user_name"`
	Id       uint   `json:"id"`
	//Password string `json:"password"`
	jwt.RegisteredClaims
}

func CheckToken

func CheckToken(token string) (*MyClaims, error)

验证token

Jump to

Keyboard shortcuts

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