update
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Description : gorm v2 版本接口实现
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-03-01 9:52 下午
|
||||
package wrapper
|
||||
@ -24,7 +24,7 @@ import (
|
||||
|
||||
// NewGormV2 获取日志实例
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// 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) {
|
||||
@ -47,7 +47,7 @@ func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.En
|
||||
|
||||
// Gorm v2 版本库日志实现
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 9:55 下午 2021/3/1
|
||||
type Gorm struct {
|
||||
@ -58,7 +58,7 @@ type Gorm struct {
|
||||
|
||||
// LogMode ...
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:08 下午 2021/3/1
|
||||
func (g *Gorm) LogMode(level logger.LogLevel) logger.Interface {
|
||||
@ -67,7 +67,7 @@ func (g *Gorm) LogMode(level logger.LogLevel) logger.Interface {
|
||||
|
||||
// Info 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:18 下午 2021/3/1
|
||||
func (g *Gorm) Info(ctx context.Context, s string, i ...interface{}) {
|
||||
@ -81,7 +81,7 @@ func (g *Gorm) Info(ctx context.Context, s string, i ...interface{}) {
|
||||
|
||||
// Warn ...
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:16 下午 2021/3/1
|
||||
func (g *Gorm) Warn(ctx context.Context, s string, i ...interface{}) {
|
||||
@ -95,7 +95,7 @@ func (g *Gorm) Warn(ctx context.Context, s string, i ...interface{}) {
|
||||
|
||||
// Error 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:18 下午 2021/3/1
|
||||
func (g *Gorm) Error(ctx context.Context, s string, i ...interface{}) {
|
||||
@ -109,7 +109,7 @@ func (g *Gorm) Error(ctx context.Context, s string, i ...interface{}) {
|
||||
|
||||
// Trace Trace 记录
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:19 下午 2021/3/1
|
||||
func (g *Gorm) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
|
||||
@ -136,7 +136,7 @@ func (g *Gorm) Trace(ctx context.Context, begin time.Time, fc func() (string, in
|
||||
|
||||
// getTraceID 获取traceID
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:11 下午 2021/3/1
|
||||
func (g *Gorm) getTraceID(ctx context.Context) string {
|
||||
@ -145,7 +145,7 @@ func (g *Gorm) getTraceID(ctx context.Context) string {
|
||||
|
||||
// GetGormSQL 获取tracefn
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:38 下午 2021/3/1
|
||||
func GetGormSQL(dbClient *gorm.DB) func() (string, int64) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Description : http_gin 使用gin框架时的,记录日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-01-03 3:43 下午
|
||||
package wrapper
|
||||
@ -19,7 +19,7 @@ import (
|
||||
|
||||
// NewGinLogger 使用gin框架记录日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// 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) {
|
||||
@ -43,7 +43,7 @@ func NewGinLogger(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore
|
||||
|
||||
// Gin 包装gin实例
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 3:59 下午 2021/1/3
|
||||
type Gin struct {
|
||||
@ -53,7 +53,7 @@ type Gin struct {
|
||||
|
||||
// formatFieldList 格式化日志field列表
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:13 下午 2021/1/3
|
||||
func (gw *Gin) formatFieldList(ginCtx *gin.Context, inputFieldList []zap.Field) []zap.Field {
|
||||
@ -74,7 +74,7 @@ func (gw *Gin) formatFieldList(ginCtx *gin.Context, inputFieldList []zap.Field)
|
||||
|
||||
// Debug 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:14 下午 2021/1/3
|
||||
func (gw *Gin) Debug(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
@ -84,7 +84,7 @@ func (gw *Gin) Debug(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
|
||||
// Info 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:28 下午 2021/1/3
|
||||
func (gw *Gin) Info(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
@ -94,7 +94,7 @@ func (gw *Gin) Info(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
|
||||
// Warn 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:29 下午 2021/1/3
|
||||
func (gw *Gin) Warn(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
@ -104,7 +104,7 @@ func (gw *Gin) Warn(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
|
||||
// Error 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:29 下午 2021/1/3
|
||||
func (gw *Gin) Error(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
@ -114,7 +114,7 @@ func (gw *Gin) Error(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
|
||||
// Panic 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:29 下午 2021/1/3
|
||||
func (gw *Gin) Panic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
@ -124,7 +124,7 @@ func (gw *Gin) Panic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
|
||||
// DPanic 日志
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 4:30 下午 2021/1/3
|
||||
func (gw *Gin) DPanic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
@ -134,7 +134,7 @@ func (gw *Gin) DPanic(ginCtx *gin.Context, msg string, field ...zap.Field) {
|
||||
|
||||
// GetZapLoggerInstance 获取zap日志实例
|
||||
//
|
||||
// Author : go_developer@163.com<张德满>
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021/01/03 22:56:47
|
||||
func (gw *Gin) GetZapLoggerInstance() *zap.Logger {
|
||||
|
Reference in New Issue
Block a user