Compare commits
51 Commits
941e7a1871
...
master
Author | SHA1 | Date | |
---|---|---|---|
163236205a | |||
f6a779fad7 | |||
ea78e582bb | |||
21efb0bb85 | |||
c472c9c078 | |||
77bf0b2a00 | |||
f5d7f54a55 | |||
688d6b7446 | |||
fee53ce64d | |||
696310e89f | |||
6ab4dff6a1 | |||
3c63197d3e | |||
afda8c14a6 | |||
eab7bab9d7 | |||
98eb52ae30 | |||
8ae4053b24 | |||
d6b517ea7a | |||
f2852c8634 | |||
80b1484ef0 | |||
76e459ffcc | |||
0bc05b3816 | |||
77de4c7fd9 | |||
2feb4d661c | |||
0ac5145c24 | |||
d978913b67 | |||
dab0b5e0b9 | |||
1f571db971 | |||
c2dafa4142 | |||
68f8b242dd | |||
7ad6f6da41 | |||
73d6ae7460 | |||
f0e03d6910 | |||
c4b4c68394 | |||
408f33b21e | |||
16d33f84ca | |||
54993a0ed4 | |||
da9b210104 | |||
785c9a2e48 | |||
4c5a5ad0f1 | |||
4566a456d9 | |||
43ebfc11aa | |||
532ea798c3 | |||
4326fad68c | |||
b9bb99b256 | |||
18dcfd6a90 | |||
013e3feb3c | |||
fff01c4405 | |||
cc006cfce7 | |||
e536831e80 | |||
3f63f6c673 | |||
cf395d3dc4 |
91
config.go
91
config.go
@ -10,28 +10,17 @@ package logger
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
// TimeIntervalType 日志时间间隔类型
|
||||
type TimeIntervalType uint
|
||||
|
||||
const (
|
||||
// TimeIntervalTypeMinute 按分钟切割
|
||||
TimeIntervalTypeMinute = TimeIntervalType(0)
|
||||
// TimeIntervalTypeHour 按小时切割
|
||||
TimeIntervalTypeHour = TimeIntervalType(1)
|
||||
// TimeIntervalTypeDay 按天切割
|
||||
TimeIntervalTypeDay = TimeIntervalType(2)
|
||||
// TimeIntervalTypeMonth 按月切割
|
||||
TimeIntervalTypeMonth = TimeIntervalType(3)
|
||||
// TimeIntervalTypeYear 按年切割
|
||||
TimeIntervalTypeYear = TimeIntervalType(4)
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultDivisionChar 默认的时间格式分隔符
|
||||
DefaultDivisionChar = "-"
|
||||
@ -43,13 +32,13 @@ const (
|
||||
//
|
||||
// Date : 3:08 下午 2021/1/2
|
||||
type RotateLogConfig struct {
|
||||
TimeIntervalType TimeIntervalType `json:"time_interval_type" yaml:"time_interval_type"` // 日志切割的时间间隔类型 0 - 小时 1 - 天 2 - 月 3 - 年
|
||||
TimeInterval time.Duration `json:"time_interval" yaml:"time_interval"` // 日志切割的时间间隔
|
||||
LogPath string `json:"log_path" yaml:"log_path"` // 存储日志的路径
|
||||
LogFileName string `json:"log_file_name" yaml:"log_file_name"` // 日志文件名
|
||||
DivisionChar string `json:"division_char" yaml:"division_char"` // 日志文件拼时间分隔符
|
||||
FullLogFormat string `json:"full_log_format" yaml:"full_log_format"` // 完整的日志格式
|
||||
MaxAge time.Duration `json:"max_age" yaml:"max_age"` // 日志最长保存时间
|
||||
TimeIntervalType consts.LogSplit `json:"time_interval_type" yaml:"time_interval_type"` // 日志切割的时间间隔类型 0 - 小时 1 - 天 2 - 月 3 - 年
|
||||
TimeInterval time.Duration `json:"time_interval" yaml:"time_interval"` // 日志切割的时间间隔
|
||||
LogPath string `json:"log_path" yaml:"log_path"` // 存储日志的路径
|
||||
LogFileName string `json:"log_file_name" yaml:"log_file_name"` // 日志文件名
|
||||
DivisionChar string `json:"division_char" yaml:"division_char"` // 日志文件拼时间分隔符
|
||||
FullLogFormat string `json:"full_log_format" yaml:"full_log_format"` // 完整的日志格式
|
||||
MaxAge time.Duration `json:"max_age" yaml:"max_age"` // 日志最长保存时间
|
||||
}
|
||||
|
||||
// SetRotateLogConfigFunc 设置日志切割的选项
|
||||
@ -64,7 +53,7 @@ type SetRotateLogConfigFunc func(rlc *RotateLogConfig)
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 3:34 下午 2021/1/2
|
||||
func WithTimeIntervalType(timeIntervalType TimeIntervalType) SetRotateLogConfigFunc {
|
||||
func WithTimeIntervalType(timeIntervalType consts.LogSplit) SetRotateLogConfigFunc {
|
||||
return func(rlc *RotateLogConfig) {
|
||||
rlc.TimeIntervalType = timeIntervalType
|
||||
}
|
||||
@ -102,7 +91,7 @@ func NewRotateLogConfig(logPath string, logFile string, option ...SetRotateLogCo
|
||||
return nil, LogPathEmptyError()
|
||||
}
|
||||
c := &RotateLogConfig{
|
||||
TimeIntervalType: TimeIntervalTypeHour,
|
||||
TimeIntervalType: consts.LogSplitHour,
|
||||
LogPath: logPath,
|
||||
LogFileName: logFile,
|
||||
DivisionChar: "",
|
||||
@ -130,40 +119,40 @@ func formatConfig(c *RotateLogConfig) error {
|
||||
c.DivisionChar = DefaultDivisionChar
|
||||
}
|
||||
// 格式化路径
|
||||
logPathByte := []byte(c.LogPath)
|
||||
if string(logPathByte[len(logPathByte)-1]) != "/" {
|
||||
c.LogPath = c.LogPath + "/"
|
||||
}
|
||||
c.LogPath = strings.TrimRight(c.LogPath, string(filepath.Separator)) + string(filepath.Separator)
|
||||
|
||||
// 检测路径是否存在,不存在自动创建
|
||||
if _, err := os.Stat(c.LogPath); nil != err {
|
||||
if !os.IsNotExist(err) {
|
||||
// 异常不是路径不存在,抛异常
|
||||
return DealLogPathError(err, c.LogPath)
|
||||
}
|
||||
if err := os.Mkdir(c.LogPath, os.ModePerm); nil != err {
|
||||
if err = os.Mkdir(c.LogPath, os.ModePerm); nil != err {
|
||||
return DealLogPathError(err, "创建日志目录失败")
|
||||
}
|
||||
}
|
||||
|
||||
c.TimeIntervalType = consts.LogSplit(strings.ToUpper(c.TimeIntervalType.String()))
|
||||
if !c.TimeIntervalType.IsValid() {
|
||||
// 非法的日志切割规则,默认按天切
|
||||
c.TimeIntervalType = consts.LogSplitDay
|
||||
}
|
||||
// 生成格式化日志全路径
|
||||
switch c.TimeIntervalType {
|
||||
case TimeIntervalTypeMinute:
|
||||
c.TimeInterval = time.Minute
|
||||
c.FullLogFormat = c.LogPath + "%Y" + c.DivisionChar + "%m" + c.DivisionChar + "%d" + c.DivisionChar + "%H" + c.DivisionChar + "%M" + c.DivisionChar + c.LogFileName
|
||||
case TimeIntervalTypeHour:
|
||||
case consts.LogSplitHour:
|
||||
c.TimeInterval = time.Hour
|
||||
c.FullLogFormat = c.LogPath + "%Y" + c.DivisionChar + "%m" + c.DivisionChar + "%d" + c.DivisionChar + "%H" + c.DivisionChar + c.LogFileName
|
||||
case TimeIntervalTypeDay:
|
||||
case consts.LogSplitDay:
|
||||
c.TimeInterval = time.Hour * 24
|
||||
c.FullLogFormat = c.LogPath + "%Y" + c.DivisionChar + "%m" + c.DivisionChar + "%d" + c.DivisionChar + c.LogFileName
|
||||
case TimeIntervalTypeMonth:
|
||||
case consts.LogSplitMonth:
|
||||
c.TimeInterval = time.Hour * 24 * 30
|
||||
c.FullLogFormat = c.LogPath + "%Y" + c.DivisionChar + "%m" + c.DivisionChar + c.LogFileName
|
||||
case TimeIntervalTypeYear:
|
||||
case consts.LogSplitYear:
|
||||
c.TimeInterval = time.Hour * 24 * 365
|
||||
c.FullLogFormat = c.LogPath + "%Y" + c.DivisionChar + c.LogFileName
|
||||
default:
|
||||
return LogSplitTypeError(c.TimeIntervalType)
|
||||
return LogSplitTypeError(c.TimeIntervalType.String())
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -233,18 +222,19 @@ func defaultEncodeDuration(d time.Duration, enc zapcore.PrimitiveArrayEncoder) {
|
||||
//
|
||||
// Date : 11:41 下午 2021/1/2
|
||||
type OptionLogger struct {
|
||||
UseJsonFormat bool // 日志使用json格式
|
||||
MessageKey string // message 字段
|
||||
LevelKey string // level 字段
|
||||
TimeKey string // 时间字段
|
||||
CallerKey string // 记录日志的文件的代码行数
|
||||
UseShortCaller bool // 使用短的调用文件格式
|
||||
TimeEncoder zapcore.TimeEncoder // 格式化时间的函数
|
||||
EncodeDuration zapcore.DurationEncoder // 原始时间信息
|
||||
WithCaller bool // 是否打印文件行号
|
||||
WithCallerSkip int // 跳过的调用数
|
||||
ConsoleOutput bool // 控制台输出
|
||||
Encoder zapcore.Encoder // 编码函数
|
||||
UseJsonFormat bool // 日志使用json格式
|
||||
MessageKey string // message 字段
|
||||
LevelKey string // level 字段
|
||||
TimeKey string // 时间字段
|
||||
CallerKey string // 记录日志的文件的代码行数
|
||||
UseShortCaller bool // 使用短的调用文件格式
|
||||
TimeEncoder zapcore.TimeEncoder // 格式化时间的函数
|
||||
EncodeDuration zapcore.DurationEncoder // 原始时间信息
|
||||
WithCaller bool // 是否打印文件行号
|
||||
WithCallerSkip int // 跳过的调用数
|
||||
ConsoleOutput bool // 控制台输出
|
||||
Encoder zapcore.Encoder // 编码函数
|
||||
ZincCollectConfig *ZincConfig // zinc采集配置
|
||||
}
|
||||
|
||||
// SetLoggerOptionFunc 设置日志配置
|
||||
@ -388,6 +378,13 @@ func WithEncodeDuration(encoder zapcore.DurationEncoder) SetLoggerOptionFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// WithZincLogCollect zinc日志采集
|
||||
func WithZincLogCollect(zincCfg *ZincConfig) SetLoggerOptionFunc {
|
||||
return func(o *OptionLogger) {
|
||||
o.ZincCollectConfig = zincCfg
|
||||
}
|
||||
}
|
||||
|
||||
// GetEncoder 获取空中台输出的encoder
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
2
debug.go
2
debug.go
@ -17,7 +17,7 @@ import (
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 1:06 上午 2021/1/3
|
||||
func FormatJson(src interface{}) string {
|
||||
func FormatJson(src any) string {
|
||||
byteData, _ := json.Marshal(src)
|
||||
|
||||
var str bytes.Buffer
|
||||
|
177
define.go
Normal file
177
define.go
Normal file
@ -0,0 +1,177 @@
|
||||
// Package logger ...
|
||||
//
|
||||
// Description : logger ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2022-06-12 18:39
|
||||
package logger
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/websocket/storage"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
var (
|
||||
wsLoggerConnect storage.IConnection // ws 日志连接管理实例
|
||||
)
|
||||
|
||||
// SetWsLoggerConnect 设置ws connect
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:20 2024/7/23
|
||||
func SetWsLoggerConnect(connect storage.IConnection) {
|
||||
wsLoggerConnect = connect
|
||||
}
|
||||
|
||||
// GetWsLoggConnect 获取ws连接
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:34 2024/7/23
|
||||
func GetWsLoggConnect() storage.IConnection {
|
||||
return wsLoggerConnect
|
||||
}
|
||||
|
||||
// LogData 记录日志数据
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:07 2024/7/23
|
||||
type LogData struct {
|
||||
Env string `json:"env"` // 运行环境
|
||||
Uri string `json:"uri"` // 请求的接口
|
||||
TraceID string `json:"trace_id"` // 请求的trace_id
|
||||
UserID string `json:"user_id"` // 用户ID
|
||||
UserRoleID string `json:"user_role_id"` // 用户角色
|
||||
OperateMode string `json:"operate_mode"` // 操作模式
|
||||
LogType string `json:"log_type"` // 日志类型
|
||||
CodeVersion string `json:"code_version"` // 代码版本
|
||||
ServiceVersion string `json:"service_version"` // 服务本身的版本
|
||||
ClientIp string `json:"client_ip"` // 客户端IP
|
||||
ServerIp string `json:"server_ip"` // 服务器IP
|
||||
Hostname string `json:"hostname"` // 服务器主机名
|
||||
Code string `json:"code"` // 日志状态码
|
||||
Data map[string]any `json:"data"` // 扩展记录的数据, 会展开一层进行记录
|
||||
}
|
||||
|
||||
// InputLogConfig 输入的日志配置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:40 2022/6/12
|
||||
type InputLogConfig struct {
|
||||
Name string `json:"name" yaml:"name"` // 日志文件名
|
||||
Path string `json:"path" yaml:"path"` // 日志文件路径
|
||||
TimeIntervalType consts.LogSplit `json:"time_interval_type" yaml:"time_interval_type"` // 日志切割规则
|
||||
DivisionChar string `json:"division_char" yaml:"division_char"` // 文件名分隔符
|
||||
LogLevel consts.LogLevel `json:"log_level" yaml:"log_level"` // 日志等级
|
||||
Console bool `json:"console" yaml:"console"` // 是否进行控制台日志输出
|
||||
UseJson bool `json:"use_json" yaml:"use_json"` // 日志是否使用JSON格式
|
||||
FileLine bool `json:"file_line" yaml:"file_line"` // 日志是否打印行号
|
||||
MessageKey string `json:"message_key" yaml:"message_key"` // message 字段
|
||||
LevelKey string `json:"level_key" yaml:"level_key"` // level 字段
|
||||
TimeKey string `json:"time_key" yaml:"time_key"` // 时间字段
|
||||
CallerKey string `json:"caller_key" yaml:"caller_key"` // 记录日志的文件的代码行数
|
||||
UseShortFile bool `json:"use_short_file" yaml:"use_short_file"` // 是否使用短文件格式
|
||||
CallerSkip int `json:"caller_skip" yaml:"caller_skip"` // 日志记录的文件跳过多少层
|
||||
MaxAge int `json:"max_age" yaml:"max_age"` // 日志最长保存时间, 单位 : 秒
|
||||
ZincSyncConfig *ZincConfig `json:"zinc_sync_config" yaml:"zinc_sync_config"` // 日志同步至zinc的配置
|
||||
}
|
||||
|
||||
// GetLogInstanceFromInputConfig 从输入配置获取日志实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:43 2022/6/12
|
||||
func GetLogInstanceFromInputConfig(logConf *InputLogConfig) (*zap.Logger, error) {
|
||||
if nil == logConf {
|
||||
return nil, nil
|
||||
}
|
||||
logConfList := []SetLoggerOptionFunc{
|
||||
WithCallerSkip(logConf.CallerSkip),
|
||||
WithCaller(),
|
||||
WithUseJsonFormat(logConf.UseJson),
|
||||
WithShortCaller(logConf.UseShortFile),
|
||||
}
|
||||
if logConf.Console {
|
||||
logConfList = append(logConfList, WithConsoleOutput())
|
||||
}
|
||||
// 配置zinc日志同步
|
||||
logConfList = append(logConfList, WithZincLogCollect(logConf.ZincSyncConfig))
|
||||
|
||||
var (
|
||||
err error
|
||||
loggerInstance *zap.Logger
|
||||
splitConfig *RotateLogConfig
|
||||
)
|
||||
if splitConfig, err = NewRotateLogConfig(
|
||||
logConf.Path,
|
||||
logConf.Name,
|
||||
WithDivisionChar(logConf.DivisionChar),
|
||||
WithTimeIntervalType(logConf.TimeIntervalType),
|
||||
WithMaxAge(time.Duration(logConf.MaxAge)*time.Second)); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
if loggerInstance, err = NewLogger(logConf.LogLevel, splitConfig, logConfList...); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
return loggerInstance, nil
|
||||
}
|
||||
|
||||
// inputLevel2ZapLevel 输入日志等级转化为zap日志等级
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:07 2024/6/24
|
||||
func inputLevel2ZapLevel(inputLoggerLevel consts.LogLevel) zapcore.Level {
|
||||
inputLoggerLevel = consts.LogLevel(strings.ToUpper(inputLoggerLevel.String()))
|
||||
if !inputLoggerLevel.IsValid() {
|
||||
// 非法的日志等级, 自动重定向为 info 级别
|
||||
inputLoggerLevel = consts.LogLevelInfo
|
||||
}
|
||||
loggerLevel := zapcore.DebugLevel
|
||||
switch inputLoggerLevel {
|
||||
case consts.LogLevelDebug:
|
||||
loggerLevel = zapcore.DebugLevel
|
||||
case consts.LogLevelInfo:
|
||||
loggerLevel = zapcore.InfoLevel
|
||||
case consts.LogLevelWarn:
|
||||
loggerLevel = zapcore.WarnLevel
|
||||
case consts.LogLevelError:
|
||||
loggerLevel = zapcore.ErrorLevel
|
||||
case consts.LogLevelPanic:
|
||||
loggerLevel = zapcore.PanicLevel
|
||||
}
|
||||
return loggerLevel
|
||||
}
|
||||
|
||||
// ZincConfig zinc服务配置
|
||||
type ZincConfig struct {
|
||||
Authorization string `json:"authorization" dc:"授权secret,生成方式base64(user:password)"`
|
||||
Domain string `json:"domain" dc:"zinc服务域名"`
|
||||
Timeout int `json:"timeout" dc:"超时时间,单位毫秒,默认5000"`
|
||||
Async bool `json:"async" dc:"数据异步写入"`
|
||||
Index string `json:"index" dc:"日志使用的索引"`
|
||||
CreateType string `json:"create_type" dc:"日志同步的类型: single - 单个同步 batch - 批量创建"`
|
||||
BufferSize int `json:"buffer_size" dc:"批量创建时, 数据缓存buffer大小, 默认1000"`
|
||||
ForceSyncTime int `json:"force_sync_time" dc:"批量同步日志时,强制同步的时间间隔,buffer没满也会强制同步, 单位: 秒"`
|
||||
}
|
||||
|
||||
const (
|
||||
DefaultTimeout = 5000 // 默认超时时间
|
||||
DefaultBufferSize = 1000 // 默认buffer大小
|
||||
DefaultForceFlushLogTime = 1000 // 强制刷新日志的时间间隔, 单位毫秒
|
||||
)
|
||||
|
||||
const (
|
||||
CreateTypeSingle = "single" // 逐条日志同步
|
||||
CreateTypeBatch = "batch" // 批量日志同步
|
||||
)
|
2
error.go
2
error.go
@ -50,7 +50,7 @@ func DealLogPathError(err error, logPath string) error {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:50 下午 2021/1/2
|
||||
func LogSplitTypeError(splitType TimeIntervalType) error {
|
||||
func LogSplitTypeError(splitType string) error {
|
||||
return errors.Wrapf(errors.New("日志切割时间类型错误"), "日志切割时间类型错误, 传入类型 : %v", splitType)
|
||||
}
|
||||
|
||||
|
80
go.mod
80
go.mod
@ -1,36 +1,72 @@
|
||||
module git.zhangdeman.cn/zhangdeman/logger
|
||||
|
||||
go 1.17
|
||||
go 1.24.1
|
||||
|
||||
toolchain go1.24.2
|
||||
|
||||
require (
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20220404153548-f65ee3641a1e
|
||||
github.com/gin-gonic/gin v1.7.7
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250425024726-cc17224cb995
|
||||
git.zhangdeman.cn/zhangdeman/gin v0.0.0-20250413074621-24f33309b9d8
|
||||
git.zhangdeman.cn/zhangdeman/network v0.0.0-20250425082854-19992ab41c78
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20250426132259-73cf1be49c7f
|
||||
git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20241125101541-c5ea194c9c1e
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||
github.com/pkg/errors v0.9.1
|
||||
go.uber.org/zap v1.20.0
|
||||
gorm.io/gorm v1.22.4
|
||||
go.uber.org/zap v1.27.0
|
||||
gorm.io/gorm v1.25.3
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.10.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda // indirect
|
||||
git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20241101082529-28a6c68e38a4 // indirect
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0 // indirect
|
||||
git.zhangdeman.cn/zhangdeman/trace v0.0.0-20250412104923-c1ecb1bfe8d5 // indirect
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e // indirect
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250321102712-1cbfbe959740 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
|
||||
github.com/bytedance/sonic v1.13.2 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.4 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/jonboulle/clockwork v0.3.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/leodido/go-urn v1.2.1 // indirect
|
||||
github.com/lestrrat-go/strftime v1.0.5 // indirect
|
||||
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lestrrat-go/strftime v1.1.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mcuadros/go-defaults v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/ugorji/go/codec v1.2.7 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.7.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
|
||||
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
github.com/mozillazg/go-pinyin v0.20.0 // indirect
|
||||
github.com/mssola/user_agent v0.6.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/sbabiv/xml2map v1.2.1 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/tidwall/gjson v1.18.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/arch v0.16.0 // indirect
|
||||
golang.org/x/crypto v0.37.0 // indirect
|
||||
golang.org/x/net v0.39.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/text v0.24.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
269
go.sum
269
go.sum
@ -1,155 +1,176 @@
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20220404153548-f65ee3641a1e h1:sSemK4Q1HmqM9ZM8KXre9polJeXVScNrPsXIDih5Xys=
|
||||
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20220404153548-f65ee3641a1e/go.mod h1:YuvLB+lJbmG1oFRUIMF7JVnrfLqeXUYoZqKt103xsOg=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250425024726-cc17224cb995 h1:LmPRAf0AsxRVFPibdpZR89ajlsz8hof2IvMMyTqiEq4=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250425024726-cc17224cb995/go.mod h1:5p8CEKGBxi7qPtTXDI3HDmqKAfIm5i/aBWdrbkbdNjc=
|
||||
git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda h1:bMD6r9gjRy7cO+T4zRQVYAesgIblBdTnhzT1vN5wjvI=
|
||||
git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda/go.mod h1:dT0rmHcJ9Z9IqWeMIt7YzR88nKkNV2V3dfG0j9Q6lK0=
|
||||
git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20241101082529-28a6c68e38a4 h1:s6d4b6yY+NaK1AzoBD1pxqsuygEHQz0Oie86c45geDw=
|
||||
git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20241101082529-28a6c68e38a4/go.mod h1:V4Dfg1v/JVIZGEKCm6/aehs8hK+Xow1dkL1yiQymXlQ=
|
||||
git.zhangdeman.cn/zhangdeman/gin v0.0.0-20250413074621-24f33309b9d8 h1:8Wt/SSVJSBR8/nddY+YYERTExc0DHrmShkk6GFUdWzw=
|
||||
git.zhangdeman.cn/zhangdeman/gin v0.0.0-20250413074621-24f33309b9d8/go.mod h1:HRY0KP893Oo1TZLPKv3XhAIhnMdtIipiylNsmJfZzD4=
|
||||
git.zhangdeman.cn/zhangdeman/network v0.0.0-20250425082854-19992ab41c78 h1:IFFHrl01z//K0aoNGzLkb46SQfFDaiSONwivWZpa3uE=
|
||||
git.zhangdeman.cn/zhangdeman/network v0.0.0-20250425082854-19992ab41c78/go.mod h1:LKktkiO4at2XvPh/i9VPuT17DxLbBcDHUGMdrRSHNO4=
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0 h1:gUDlQMuJ4xNfP2Abl1Msmpa3fASLWYkNlqDFF/6GN0Y=
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0/go.mod h1:VHb9qmhaPDAQDcS6vUiDCamYjZ4R5lD1XtVsh55KsMI=
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20250426132259-73cf1be49c7f h1:7QgAcGnmVEVyIPeWH0ZkQN/jpzklYXsKCenTR2GpxbE=
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20250426132259-73cf1be49c7f/go.mod h1:Ig3GZC2hJDkQp7F8Tm53GvMWLh9bdbbauow/vxGO4YA=
|
||||
git.zhangdeman.cn/zhangdeman/trace v0.0.0-20250412104923-c1ecb1bfe8d5 h1:dD1Q/MIrRmIhKqfYPH+y167ca9CKwTPuQt3c1hXWGJ8=
|
||||
git.zhangdeman.cn/zhangdeman/trace v0.0.0-20250412104923-c1ecb1bfe8d5/go.mod h1:PB486NC82nuvn5yi+U2i48ogX/9EAETWAHd8O9TwY9k=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e h1:Q973S6CcWr1ICZhFI1STFOJ+KUImCl2BaIXm6YppBqI=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e/go.mod h1:VpPjBlwz8U+OxZuxzHQBv1aEEZ3pStH6bZvT21ADEbI=
|
||||
git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20241125101541-c5ea194c9c1e h1:YE2Gi+M03UDImIpWa3I7jzSesyfu2RL8x/4ONs5v0oE=
|
||||
git.zhangdeman.cn/zhangdeman/websocket v0.0.0-20241125101541-c5ea194c9c1e/go.mod h1:L/7JugxKZL3JP9JP/XDvPAPz0FQXG1u181Su1+u/d1c=
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250321102712-1cbfbe959740 h1:zPUoylfJTbc0EcxW+NEzOTBmoeFZ2I/rLFBnEzxb4Wk=
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250321102712-1cbfbe959740/go.mod h1:1ct92dbVc49pmXusA/iGfcQUJzcYmJ+cjAhgc3sDv1I=
|
||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ=
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg=
|
||||
github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
|
||||
github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs=
|
||||
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
||||
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
|
||||
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
|
||||
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||
github.com/go-playground/validator/v10 v10.10.1 h1:uA0+amWMiglNZKZ9FJRKUAe9U3RX91eVn1JYXMWt7ig=
|
||||
github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 h1:CaO/zOnF8VvUfEbhRatPcwKVWamvbYd8tQGRWacE9kU=
|
||||
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4=
|
||||
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
||||
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
||||
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
|
||||
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas=
|
||||
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg=
|
||||
github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
||||
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
|
||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=
|
||||
github.com/lestrrat-go/strftime v1.0.5 h1:A7H3tT8DhTz8u65w+JRpiBxM4dINQhUXAZnhBa2xeOE=
|
||||
github.com/lestrrat-go/strftime v1.0.5/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR76fd03sz+Qz4g=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/lestrrat-go/strftime v1.1.0 h1:gMESpZy44/4pXLO/m+sL0yBd1W6LjgjrrD4a68Gapyg=
|
||||
github.com/lestrrat-go/strftime v1.1.0/go.mod h1:uzeIB52CeUJenCo1syghlugshMysrqUT51HlxphXVeI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc=
|
||||
github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/mozillazg/go-pinyin v0.20.0 h1:BtR3DsxpApHfKReaPO1fCqF4pThRwH9uwvXzm+GnMFQ=
|
||||
github.com/mozillazg/go-pinyin v0.20.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
|
||||
github.com/mssola/user_agent v0.6.0 h1:uwPR4rtWlCHRFyyP9u2KOV0u8iQXmS7Z7feTrstQwk4=
|
||||
github.com/mssola/user_agent v0.6.0/go.mod h1:TTPno8LPY3wAIEKRpAtkdMT0f8SE24pLRGPahjCH4uw=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||
github.com/sbabiv/xml2map v1.2.1 h1:1lT7t0hhUvXZCkdxqtq4n8/ZCnwLWGq4rDuDv5XOoFE=
|
||||
github.com/sbabiv/xml2map v1.2.1/go.mod h1:2TPoAfcaM7+Sd4iriPvzyntb2mx7GY+kkQpB/GQa/eo=
|
||||
github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY=
|
||||
github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec=
|
||||
github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY=
|
||||
github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
|
||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
|
||||
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
|
||||
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
|
||||
go.uber.org/zap v1.20.0 h1:N4oPlghZwYG55MlU6LXk/Zp00FVNE9X9wrYO8CEs4lc=
|
||||
go.uber.org/zap v1.20.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o=
|
||||
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb h1:PVGECzEo9Y3uOidtkHGdd347NjLtITfJFO9BxFpmRoo=
|
||||
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/arch v0.16.0 h1:foMtLTdyOmIniqWCHjY6+JxuC54XP1fDwx4N0ASyW+U=
|
||||
golang.org/x/arch v0.16.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
|
||||
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
|
||||
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
|
||||
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
|
||||
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376 h1:sY2a+y0j4iDrajJcorb+a0hJIQ6uakU5gybjfLWHlXo=
|
||||
gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376/go.mod h1:BHKOc1m5wm8WwQkMqYBoo4vNxhmF7xg8+xhG8L+Cy3M=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM=
|
||||
gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/gorm v1.25.3 h1:zi4rHZj1anhZS2EuEODMhDisGy+Daq9jtPrNGgbQYD8=
|
||||
gorm.io/gorm v1.25.3/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
|
33
logger.go
33
logger.go
@ -8,6 +8,7 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
@ -25,11 +26,13 @@ import (
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 5:05 下午 2021/1/2
|
||||
func NewLogger(loggerLevel zapcore.Level, splitConfig *RotateLogConfig, optionFunc ...SetLoggerOptionFunc) (*zap.Logger, error) {
|
||||
func NewLogger(inputLoggerLevel consts.LogLevel, splitConfig *RotateLogConfig, optionFunc ...SetLoggerOptionFunc) (*zap.Logger, error) {
|
||||
if nil == splitConfig {
|
||||
return nil, errors.New("未配置日志切割规则")
|
||||
}
|
||||
|
||||
loggerLevel := inputLevel2ZapLevel(inputLoggerLevel)
|
||||
|
||||
o := &OptionLogger{}
|
||||
|
||||
for _, f := range optionFunc {
|
||||
@ -56,7 +59,8 @@ func NewLogger(loggerLevel zapcore.Level, splitConfig *RotateLogConfig, optionFu
|
||||
}
|
||||
|
||||
fileHandlerList := []zapcore.Core{
|
||||
zapcore.NewCore(o.Encoder, zapcore.AddSync(loggerWriter), loggerLevelDeal),
|
||||
zapcore.NewCore(o.Encoder, zapcore.AddSync(loggerWriter), loggerLevelDeal), // 指定的日志输出位置
|
||||
zapcore.NewCore(o.Encoder, zapcore.AddSync(&wsWriter{}), loggerLevelDeal), // 设置ws日志输出
|
||||
}
|
||||
|
||||
// 设置控制台输出
|
||||
@ -64,6 +68,11 @@ func NewLogger(loggerLevel zapcore.Level, splitConfig *RotateLogConfig, optionFu
|
||||
fileHandlerList = append(fileHandlerList, zapcore.NewCore(o.Encoder, zapcore.AddSync(os.Stdout), loggerLevelDeal))
|
||||
}
|
||||
|
||||
// 设置zinc日志输出
|
||||
if nil != o.ZincCollectConfig {
|
||||
fileHandlerList = append(fileHandlerList, zapcore.NewCore(o.Encoder, zapcore.AddSync(NewZincLogConnect(o.ZincCollectConfig)), loggerLevelDeal))
|
||||
}
|
||||
|
||||
// 最后创建具体的Logger
|
||||
core := zapcore.NewTee(fileHandlerList...)
|
||||
|
||||
@ -134,3 +143,23 @@ func (l *Logger) getWriter() (io.Writer, error) {
|
||||
|
||||
return hook, nil
|
||||
}
|
||||
|
||||
type wsWriter struct {
|
||||
}
|
||||
|
||||
// Write ws的writer
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:24 2024/7/22
|
||||
func (w *wsWriter) Write(p []byte) (n int, err error) {
|
||||
if nil == wsLoggerConnect {
|
||||
return 0, nil
|
||||
}
|
||||
p = []byte(" " + string(p))
|
||||
allConnList := wsLoggerConnect.GetCtxList()
|
||||
for _, conn := range allConnList {
|
||||
_ = conn.Session.Write(p)
|
||||
}
|
||||
return 0, nil
|
||||
}
|
||||
|
111
util.go
Normal file
111
util.go
Normal file
@ -0,0 +1,111 @@
|
||||
// Package logger ...
|
||||
//
|
||||
// Description : logger ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2024-07-24 21:14
|
||||
package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
ginRequest "git.zhangdeman.cn/zhangdeman/gin/request"
|
||||
"git.zhangdeman.cn/zhangdeman/network/util"
|
||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func getStrVal(ctx context.Context, key string) string {
|
||||
if nil == ctx {
|
||||
return ""
|
||||
}
|
||||
if ginCtx, ok := ctx.(*gin.Context); ok {
|
||||
return ginRequest.WrapperHandle.GetCtxStringData(ginCtx, key, "")
|
||||
}
|
||||
val := ctx.Value(key)
|
||||
if nil == val {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%v", val)
|
||||
}
|
||||
|
||||
// NewLogDataForGin 构建gin请求的日志
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:37 2025/3/5
|
||||
func NewLogDataForGin(ctx *gin.Context, logType string, code string, logData map[string]any) *LogData {
|
||||
hostname, _ := os.Hostname()
|
||||
commonLogData := &LogData{
|
||||
Env: ginRequest.WrapperHandle.GetCtxStringData(ctx, "env", ""),
|
||||
Uri: ginRequest.WrapperHandle.GetUri(ctx, ""),
|
||||
TraceID: ginRequest.WrapperHandle.GetCtxStringData(ctx, "trace_id", ""),
|
||||
UserID: ginRequest.WrapperHandle.GetCtxStringData(ctx, "user_id", ""),
|
||||
UserRoleID: ginRequest.WrapperHandle.GetCtxStringData(ctx, "user_role_id", ""),
|
||||
OperateMode: ginRequest.WrapperHandle.GetCtxStringData(ctx, "operate_mode", ""),
|
||||
LogType: logType,
|
||||
CodeVersion: ginRequest.WrapperHandle.GetCtxStringData(ctx, "code_version", ""),
|
||||
ServiceVersion: ginRequest.WrapperHandle.GetCtxStringData(ctx, "service_version", ""),
|
||||
ClientIp: ginRequest.WrapperHandle.GetCtxStringData(ctx, "client_ip", "s"),
|
||||
ServerIp: util.IP.GetHostIP(),
|
||||
Hostname: hostname,
|
||||
Code: code,
|
||||
Data: logData,
|
||||
}
|
||||
return commonLogData
|
||||
}
|
||||
|
||||
// NewLogData ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:21 2024/7/23
|
||||
func NewLogData(ctx context.Context, logType string, code string, logData map[string]any) *LogData {
|
||||
hostname, _ := os.Hostname()
|
||||
if nil == ctx {
|
||||
ctx = context.TODO()
|
||||
}
|
||||
if ginCtx, ok := ctx.(*gin.Context); ok {
|
||||
return NewLogDataForGin(ginCtx, logType, code, logData)
|
||||
}
|
||||
commonLogData := &LogData{
|
||||
Env: getStrVal(ctx, "env"),
|
||||
Uri: getStrVal(ctx, "uri"),
|
||||
TraceID: getStrVal(ctx, "trace_id"),
|
||||
UserID: getStrVal(ctx, "user_id"),
|
||||
UserRoleID: getStrVal(ctx, "user_role_id"),
|
||||
OperateMode: getStrVal(ctx, "operate_mode"),
|
||||
LogType: logType,
|
||||
CodeVersion: getStrVal(ctx, "code_version"),
|
||||
ServiceVersion: getStrVal(ctx, "service_version"),
|
||||
ClientIp: getStrVal(ctx, "client_ip"),
|
||||
ServerIp: util.IP.GetHostIP(),
|
||||
Hostname: hostname,
|
||||
Code: code,
|
||||
Data: logData,
|
||||
}
|
||||
return commonLogData
|
||||
}
|
||||
|
||||
// ZapLogDataList 记录的日志数据字段列表
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:33 2024/7/23
|
||||
func ZapLogDataList(logData *LogData) []zap.Field {
|
||||
logDataList := make([]zap.Field, 0)
|
||||
if logData == nil {
|
||||
return logDataList
|
||||
}
|
||||
var mapData map[string]any
|
||||
_ = serialize.JSON.Transition(logData, &mapData)
|
||||
for k, v := range mapData {
|
||||
logDataList = append(logDataList, zap.Any(k, v))
|
||||
}
|
||||
return logDataList
|
||||
}
|
@ -13,7 +13,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
@ -30,7 +30,7 @@ import (
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 9:56 下午 2021/3/1
|
||||
func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger2.RotateLogConfig, traceIDField string, skip int) (logger.Interface, error) {
|
||||
func NewGormV2(loggerLevel consts.LogLevel, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger2.RotateLogConfig, traceIDField string, skip int) (logger.Interface, error) {
|
||||
logConfList := []logger2.SetLoggerOptionFunc{logger2.WithEncoder(encoder), logger2.WithCallerSkip(skip), logger2.WithCaller()}
|
||||
if consoleOutput {
|
||||
logConfList = append(logConfList, logger2.WithConsoleOutput())
|
||||
@ -55,16 +55,22 @@ func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.En
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 3:36 PM 2021/12/24
|
||||
func NewGormLoggerWithInstance(ctx *gin.Context, dbClient *gorm.DB, instance *zap.Logger, node string, extraCtxFieldList []string) logger.Interface {
|
||||
return &Gorm{
|
||||
func NewGormLoggerWithInstance(outCtx context.Context, dbClient *gorm.DB, instance *zap.Logger, node string, extraCtxFieldList []string) logger.Interface {
|
||||
nodeArr := strings.Split(node, "|")
|
||||
i := &Gorm{
|
||||
dbClient: dbClient,
|
||||
instance: instance,
|
||||
traceIDField: "",
|
||||
traceIDField: consts.GinTraceIDField,
|
||||
extraCtxFieldList: extraCtxFieldList,
|
||||
flag: "",
|
||||
node: node,
|
||||
ctx: ctx,
|
||||
outCtx: outCtx,
|
||||
}
|
||||
if len(nodeArr) >= 2 {
|
||||
i.node = nodeArr[1]
|
||||
i.flag = nodeArr[0]
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
// Gorm v2 版本库日志实现
|
||||
@ -74,12 +80,12 @@ func NewGormLoggerWithInstance(ctx *gin.Context, dbClient *gorm.DB, instance *za
|
||||
// Date : 9:55 下午 2021/3/1
|
||||
type Gorm struct {
|
||||
dbClient *gorm.DB
|
||||
instance *zap.Logger // 日志实例
|
||||
traceIDField string // 串联请求上下文的的ID
|
||||
extraCtxFieldList []string // 从请求上线问提取的字段
|
||||
flag string // 数据库标识
|
||||
node string // 数据库节点 master / slave
|
||||
ctx *gin.Context // gin上下文
|
||||
instance *zap.Logger // 日志实例
|
||||
traceIDField string // 串联请求上下文的的ID
|
||||
extraCtxFieldList []string // 从请求上线问提取的字段
|
||||
flag string // 数据库标识
|
||||
node string // 数据库节点 master / slave
|
||||
outCtx context.Context
|
||||
}
|
||||
|
||||
// LogMode ...
|
||||
@ -96,8 +102,10 @@ func (g *Gorm) LogMode(level logger.LogLevel) logger.Interface {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:18 下午 2021/3/1
|
||||
func (g *Gorm) Info(ctx context.Context, s string, i ...interface{}) {
|
||||
g.write(nil, "info")
|
||||
func (g *Gorm) Info(ctx context.Context, s string, i ...any) {
|
||||
g.write(ctx, s, consts.LogLevelInfo, map[string]any{
|
||||
"log_data": i,
|
||||
})
|
||||
}
|
||||
|
||||
// Warn ...
|
||||
@ -105,8 +113,10 @@ func (g *Gorm) Info(ctx context.Context, s string, i ...interface{}) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:16 下午 2021/3/1
|
||||
func (g *Gorm) Warn(ctx context.Context, s string, i ...interface{}) {
|
||||
g.write(nil, "warn")
|
||||
func (g *Gorm) Warn(ctx context.Context, s string, i ...any) {
|
||||
g.write(ctx, s, consts.LogLevelWarn, map[string]any{
|
||||
"log_data": i,
|
||||
})
|
||||
}
|
||||
|
||||
// Error 日志
|
||||
@ -114,8 +124,10 @@ func (g *Gorm) Warn(ctx context.Context, s string, i ...interface{}) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:18 下午 2021/3/1
|
||||
func (g *Gorm) Error(ctx context.Context, s string, i ...interface{}) {
|
||||
g.write(nil, "error")
|
||||
func (g *Gorm) Error(ctx context.Context, s string, i ...any) {
|
||||
g.write(ctx, s, consts.LogLevelError, map[string]any{
|
||||
"log_data": i,
|
||||
})
|
||||
}
|
||||
|
||||
// Trace Trace 记录
|
||||
@ -132,18 +144,20 @@ func (g *Gorm) Trace(ctx context.Context, begin time.Time, fc func() (string, in
|
||||
sql, affectRows = fc()
|
||||
}
|
||||
|
||||
dataList := []zap.Field{
|
||||
zap.String(g.traceIDField, g.getTraceID(ctx)),
|
||||
zap.String("db_flag", g.flag),
|
||||
zap.Int64("begin_time", start),
|
||||
zap.Int64("finish_time", end),
|
||||
zap.String("used_time", fmt.Sprintf("%fms", float64(end-start)/1e6)),
|
||||
zap.String("sql", sql),
|
||||
zap.Int64("affect_rows", affectRows),
|
||||
zap.Error(err),
|
||||
logData := map[string]any{
|
||||
"db_flag": g.flag,
|
||||
"db_node": g.node,
|
||||
"begin_time": start,
|
||||
"finish_time": end,
|
||||
"used_time": (end - start) / 1e6,
|
||||
"sql": sql,
|
||||
"affect_rows": affectRows,
|
||||
"err": "",
|
||||
}
|
||||
g.write(dataList, "info")
|
||||
|
||||
if nil != err {
|
||||
logData["err"] = err.Error()
|
||||
}
|
||||
g.write(ctx, "SQL执行记录", consts.LogLevelInfo, logData)
|
||||
}
|
||||
|
||||
// write ...
|
||||
@ -151,46 +165,45 @@ func (g *Gorm) Trace(ctx context.Context, begin time.Time, fc func() (string, in
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:11 PM 2021/12/24
|
||||
func (g *Gorm) write(dataList []zap.Field, level string) {
|
||||
func (g *Gorm) write(ctx context.Context, message string, level consts.LogLevel, data map[string]any) {
|
||||
if len(message) == 0 {
|
||||
message = "SQL执行记录"
|
||||
}
|
||||
if nil == g.instance {
|
||||
// 未设置日志实例
|
||||
return
|
||||
}
|
||||
if nil == dataList {
|
||||
dataList = make([]zap.Field, 0)
|
||||
if nil == data {
|
||||
data = make(map[string]any)
|
||||
}
|
||||
if nil != g.ctx {
|
||||
for _, extraField := range g.extraCtxFieldList {
|
||||
dataList = append(dataList, zap.Any(extraField, g.ctx.Value(extraField)))
|
||||
if nil != data["sql"] {
|
||||
sqlStr := strings.TrimSpace(fmt.Sprintf("%v", data["sql"]))
|
||||
sqlArr := strings.Split(sqlStr, " ")
|
||||
if len(sqlArr) > 0 {
|
||||
data["sql_type"] = strings.ToUpper(sqlArr[0])
|
||||
}
|
||||
}
|
||||
if nil == g.outCtx {
|
||||
g.outCtx = context.Background()
|
||||
}
|
||||
|
||||
// 补齐 flag、node
|
||||
sql := g.dbClient.Dialector.Explain(g.dbClient.Statement.SQL.String(), g.dbClient.Statement.Vars...)
|
||||
affectRows := g.dbClient.RowsAffected
|
||||
dataList = append(dataList, zap.String("db_node", g.node), zap.String("db_flag", g.flag), zap.String("execute_sql", sql), zap.Int64("affect_rows", affectRows))
|
||||
message := "SQL执行记录"
|
||||
switch strings.ToLower(level) {
|
||||
case "info":
|
||||
dataList := logger2.ZapLogDataList(logger2.NewLogData(g.outCtx, consts.LogTypeDatabase, "", data))
|
||||
switch level {
|
||||
case consts.LogLevelDebug:
|
||||
g.instance.Debug(message, dataList...)
|
||||
case consts.LogLevelInfo:
|
||||
g.instance.Info(message, dataList...)
|
||||
case "warn":
|
||||
case consts.LogLevelWarn:
|
||||
g.instance.Warn(message, dataList...)
|
||||
case "error":
|
||||
case consts.LogLevelError:
|
||||
g.instance.Error(message, dataList...)
|
||||
case consts.LogLevelPanic:
|
||||
g.instance.Panic(message, dataList...)
|
||||
default:
|
||||
g.instance.Info(message, dataList...)
|
||||
}
|
||||
}
|
||||
|
||||
// getTraceID 获取traceID
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:11 下午 2021/3/1
|
||||
func (g *Gorm) getTraceID(ctx context.Context) string {
|
||||
return fmt.Sprintf("%v", ctx.Value(g.traceIDField))
|
||||
}
|
||||
|
||||
// GetGormSQL 获取trace fn
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
@ -8,11 +8,9 @@
|
||||
package wrapper
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/gopkg/logger"
|
||||
logger2 "git.zhangdeman.cn/zhangdeman/gopkg/logger"
|
||||
"github.com/gin-gonic/gin"
|
||||
"context"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/logger"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
@ -22,14 +20,14 @@ import (
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 3:45 下午 2021/1/3
|
||||
func NewGinLogger(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger.RotateLogConfig, extractFieldList []string, skip int) (*Gin, error) {
|
||||
func NewGinLogger(loggerLevel consts.LogLevel, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger.RotateLogConfig, extractFieldList []string, skip int) (*Gin, error) {
|
||||
var (
|
||||
err error
|
||||
l *zap.Logger
|
||||
)
|
||||
logConfList := []logger2.SetLoggerOptionFunc{logger2.WithEncoder(encoder), logger2.WithCaller(), logger2.WithCallerSkip(skip)}
|
||||
logConfList := []logger.SetLoggerOptionFunc{logger.WithEncoder(encoder), logger.WithCaller(), logger.WithCallerSkip(skip)}
|
||||
if consoleOutput {
|
||||
logConfList = append(logConfList, logger2.WithConsoleOutput())
|
||||
logConfList = append(logConfList, logger.WithConsoleOutput())
|
||||
}
|
||||
if l, err = logger.NewLogger(loggerLevel, splitConfig, logConfList...); nil != err {
|
||||
return nil, err
|
||||
@ -56,18 +54,16 @@ type Gin struct {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:13 下午 2021/1/3
|
||||
func (gw *Gin) formatFieldList(ginCtx *gin.Context, inputFieldList []zap.Field) []zap.Field {
|
||||
func (gw *Gin) formatFieldList(ctx context.Context, inputFieldList []zap.Field) []zap.Field {
|
||||
if nil == ctx {
|
||||
ctx = context.Background()
|
||||
}
|
||||
if nil == inputFieldList {
|
||||
inputFieldList = make([]zap.Field, 0)
|
||||
}
|
||||
if nil != ginCtx {
|
||||
// 自动扩充抽取字段,字段不存在的话,忽略掉
|
||||
for _, extractField := range gw.extractFieldList {
|
||||
if v, exist := ginCtx.Get(extractField); exist {
|
||||
byteData, _ := json.Marshal(v)
|
||||
inputFieldList = append(inputFieldList, zap.String(extractField, string(byteData)))
|
||||
}
|
||||
}
|
||||
// 自动扩充抽取字段,字段不存在的话,忽略掉
|
||||
for _, extractField := range gw.extractFieldList {
|
||||
inputFieldList = append(inputFieldList, zap.Any(extractField, ctx.Value(extractField)))
|
||||
}
|
||||
return inputFieldList
|
||||
}
|
||||
@ -77,8 +73,8 @@ func (gw *Gin) formatFieldList(ginCtx *gin.Context, inputFieldList []zap.Field)
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:14 下午 2021/1/3
|
||||
func (gw *Gin) Debug(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ginCtx, field)
|
||||
func (gw *Gin) Debug(ctx context.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ctx, field)
|
||||
gw.loggerInstance.Debug(msg, fieldList...)
|
||||
}
|
||||
|
||||
@ -87,8 +83,8 @@ func (gw *Gin) Debug(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:28 下午 2021/1/3
|
||||
func (gw *Gin) Info(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ginCtx, field)
|
||||
func (gw *Gin) Info(ctx context.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ctx, field)
|
||||
gw.loggerInstance.Info(msg, fieldList...)
|
||||
}
|
||||
|
||||
@ -97,8 +93,8 @@ func (gw *Gin) Info(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:29 下午 2021/1/3
|
||||
func (gw *Gin) Warn(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ginCtx, field)
|
||||
func (gw *Gin) Warn(ctx context.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ctx, field)
|
||||
gw.loggerInstance.Warn(msg, fieldList...)
|
||||
}
|
||||
|
||||
@ -107,8 +103,8 @@ func (gw *Gin) Warn(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:29 下午 2021/1/3
|
||||
func (gw *Gin) Error(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ginCtx, field)
|
||||
func (gw *Gin) Error(ctx context.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ctx, field)
|
||||
gw.loggerInstance.Error(msg, fieldList...)
|
||||
}
|
||||
|
||||
@ -117,8 +113,8 @@ func (gw *Gin) Error(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:29 下午 2021/1/3
|
||||
func (gw *Gin) Panic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ginCtx, field)
|
||||
func (gw *Gin) Panic(ctx context.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ctx, field)
|
||||
gw.loggerInstance.Panic(msg, fieldList...)
|
||||
}
|
||||
|
||||
@ -127,8 +123,8 @@ func (gw *Gin) Panic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:30 下午 2021/1/3
|
||||
func (gw *Gin) DPanic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ginCtx, field)
|
||||
func (gw *Gin) DPanic(ctx context.Context, msg string, field ...zap.Field) {
|
||||
fieldList := gw.formatFieldList(ctx, field)
|
||||
gw.loggerInstance.DPanic(msg, fieldList...)
|
||||
}
|
||||
|
||||
|
149
zinc_search.go
Normal file
149
zinc_search.go
Normal file
@ -0,0 +1,149 @@
|
||||
// Package logger ...
|
||||
//
|
||||
// Description : 基于zinc实现日志收集
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-04-26 21:24
|
||||
package logger
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewZincLogConnect(cfg *ZincConfig) io.Writer {
|
||||
if cfg.Timeout <= 0 {
|
||||
cfg.Timeout = DefaultTimeout
|
||||
}
|
||||
if cfg.BufferSize <= 0 {
|
||||
cfg.BufferSize = DefaultBufferSize
|
||||
}
|
||||
if cfg.ForceSyncTime <= 0 {
|
||||
cfg.ForceSyncTime = DefaultForceFlushLogTime
|
||||
}
|
||||
zlc := &zincLogConnect{
|
||||
config: cfg,
|
||||
lock: &sync.RWMutex{},
|
||||
buffer: nil,
|
||||
}
|
||||
// 批量写入强制同步任务
|
||||
go zlc.flushTask()
|
||||
return zlc
|
||||
}
|
||||
|
||||
// zincLogConnect zinc日志收集器
|
||||
type zincLogConnect struct {
|
||||
config *ZincConfig // zinc配置
|
||||
lock *sync.RWMutex // 操作锁
|
||||
buffer []map[string]any // 数据缓冲buffer
|
||||
}
|
||||
|
||||
// getPutLogFullUrl 获取请求地址,使用批量创建
|
||||
func (zlc *zincLogConnect) getPutLogFullUrl() string {
|
||||
if zlc.config.CreateType == CreateTypeBatch {
|
||||
// 批量创建
|
||||
return fmt.Sprintf("%v/api/_bulkv2", strings.TrimRight(zlc.config.Domain, "/"))
|
||||
}
|
||||
// 单条创建
|
||||
return fmt.Sprintf("%v/api/%v/_doc", strings.TrimRight(zlc.config.Domain, "/"), zlc.config.Index)
|
||||
}
|
||||
|
||||
// Write 日志写入, 要求字节数据必须是个合法的json序列化之后的结果
|
||||
func (zlc *zincLogConnect) Write(logData []byte) (int, error) {
|
||||
if zlc.config.CreateType == CreateTypeBatch {
|
||||
var (
|
||||
res map[string]any
|
||||
err error
|
||||
)
|
||||
if err = serialize.JSON.UnmarshalWithNumber(logData, &res); nil != err {
|
||||
return 0, err
|
||||
}
|
||||
// 批量
|
||||
zlc.lock.Lock()
|
||||
// 数据写入buffer
|
||||
zlc.buffer = append(zlc.buffer, res)
|
||||
if len(zlc.buffer) >= zlc.config.BufferSize {
|
||||
// buffer已满, 数据写入zinc
|
||||
zlc.flush()
|
||||
}
|
||||
zlc.lock.Unlock()
|
||||
return 0, nil
|
||||
}
|
||||
// 单个直接写入
|
||||
zlc.writeData(logData)
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// flush 日志刷入zinc服务(针对批量数据写入的)
|
||||
func (zlc *zincLogConnect) flush() {
|
||||
if zlc.config.CreateType != CreateTypeBatch {
|
||||
return
|
||||
}
|
||||
if len(zlc.buffer) == 0 {
|
||||
return
|
||||
}
|
||||
zlc.writeData(serialize.JSON.MarshalForByteIgnoreError(map[string]any{
|
||||
"index": zlc.config.Index,
|
||||
"records": zlc.buffer,
|
||||
}))
|
||||
// 清空buffer
|
||||
zlc.buffer = []map[string]any{}
|
||||
}
|
||||
|
||||
// flushTask 批量同步日志, 强制同步的定时任务(针对批量数据写入)
|
||||
func (zlc *zincLogConnect) flushTask() {
|
||||
if zlc.config.CreateType != CreateTypeBatch {
|
||||
return
|
||||
}
|
||||
for {
|
||||
time.Sleep(time.Millisecond * time.Duration(zlc.config.ForceSyncTime))
|
||||
zlc.lock.Lock()
|
||||
zlc.flush()
|
||||
zlc.lock.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
// writeData 数据写入zinc
|
||||
func (zlc *zincLogConnect) writeData(paramData []byte) {
|
||||
req, _ := http.NewRequest(http.MethodPost, zlc.getPutLogFullUrl(), bytes.NewReader(paramData))
|
||||
req.Header.Set(consts.HeaderKeyAuthorization.String(), "Basic "+zlc.config.Authorization) // 设置authorization
|
||||
req.Header.Set(consts.HeaderKeyContentType.String(), consts.MimeTypeJson) // json请求
|
||||
client := &http.Client{}
|
||||
|
||||
if zlc.config.Async {
|
||||
// 异步请求
|
||||
go func() {
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Print("异步日志写入zinc失败(请求发送失败): " + err.Error())
|
||||
return
|
||||
}
|
||||
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
|
||||
// 状态码非2xx
|
||||
log.Print("异步日志写入zinc失败(zinc服务响应状态码异常): " + resp.Status)
|
||||
return
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
// 同步请求
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Print("异步日志写入zinc失败(请求发送失败): " + err.Error())
|
||||
return
|
||||
}
|
||||
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
|
||||
// 状态码非2xx
|
||||
log.Print("异步日志写入zinc失败(zinc服务响应状态码异常): " + resp.Status)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user