zapHelper

package
v0.0.0-...-8337cb8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AlertWebHook https://developer.work.weixin.qq.com/document/path/91770
	AlertWebHook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
)

Variables

This section is empty.

Functions

func Logger

func Logger(alert bool, webhook string) log.Logger

Logger 配置zap日志,将zap日志库引入

func NewAlertEncoder

func NewAlertEncoder(encoderConf zapcore.EncoderConfig, webhook string) zapcore.Encoder

Types

type AlertEncoder

type AlertEncoder struct {
	AlertWebhook string
	zapcore.Encoder
}

func (*AlertEncoder) EncodeEntry

func (a *AlertEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (buf *buffer.Buffer, err error)

EncodeEntry alertEncoder encodeEntry

type LogContent

type LogContent struct {
	Level     string    `json:"level"`
	Time      time.Time `json:"time"`
	Caller    string    `json:"caller"`
	Msg       string    `json:"msg"`
	Stack     string    `json:"stack"`
	Color     string    `json:"color"`
	Operation string    `json:"operation"`
	Args      string    `json:"args"`
}

type WeComWebHookReply

type WeComWebHookReply struct {
	Errcode   int    `json:"errcode"`
	Errmsg    string `json:"errmsg"`
	Type      string `json:"type"`
	MediaId   string `json:"media_id"`
	CreatedAt string `json:"created_at"`
}

type ZapLogger

type ZapLogger struct {
	Sync func() error
	// contains filtered or unexported fields
}

func NewZapLogger

func NewZapLogger(encConf zapcore.EncoderConfig, level zap.AtomicLevel, alert bool, webhook string, opts ...zap.Option) *ZapLogger

NewZapLogger return a zaplog logger.

func (*ZapLogger) Log

func (l *ZapLogger) Log(level log.Level, keyvals ...interface{}) error

Log zap log

Jump to

Keyboard shortcuts

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