Documentation ¶
Index ¶
- Constants
- func DPanic(msg string, fields ...zap.Field)
- func DPanicf(msg string, args ...interface{})
- func Debug(msg string, fields ...zap.Field)
- func Debugf(msg string, args ...interface{})
- func DefaultWithMap(m map[string]interface{}) error
- func Error(msg string, fields ...zap.Field)
- func Errorf(msg string, args ...interface{})
- func Fatal(msg string, fields ...zap.Field)
- func Fatalf(msg string, args ...interface{})
- func Info(msg string, fields ...zap.Field)
- func Infof(msg string, args ...interface{})
- func InitLogZapMQ(path string)
- func Log(lvl Level, msg string, fields ...zap.Field)
- func NewRocketMQCore(enc zapcore.Encoder, topic string, MqProducer *rocketmq.MqProducer, ...) zapcore.Core
- func Warn(msg string, fields ...zap.Field)
- func Warnf(msg string, args ...interface{})
- type Base
- type FileLogger
- type FilesLogger
- type Level
- type LogBody
- type LogDingding
- type LogField
- type LogHeader
- type LogKafka
- type LogQuery
- type LogRocket
- func (l *LogRocket) MQDebug(title, trans, action string, fields ...LogField)
- func (l *LogRocket) MQError(title, trans, action string, fields ...LogField)
- func (l *LogRocket) MQInfo(title, trans, action string, fields ...LogField)
- func (l *LogRocket) MQPanic(title, trans, action string, fields ...LogField)
- func (l *LogRocket) MQWarn(title, trans, action string, fields ...LogField)
- func (l *LogRocket) SetTagKey(tag, key string) *LogRocket
- type LogRocketMQ
- type LogStatistic
- type Logger
- func (l *Logger) AddSkip(skip int) *Logger
- func (l *Logger) DPanic(msg string, fields ...zap.Field)
- func (l *Logger) DPanicf(msg string, args ...interface{})
- func (l *Logger) Debug(msg string, fields ...zap.Field)
- func (l *Logger) Debugf(msg string, args ...interface{})
- func (l *Logger) Error(msg string, fields ...zap.Field)
- func (l *Logger) Errorf(msg string, args ...interface{})
- func (l *Logger) Fatal(msg string, fields ...zap.Field)
- func (l *Logger) Fatalf(msg string, args ...interface{})
- func (l *Logger) Info(msg string, fields ...zap.Field)
- func (l *Logger) Infof(msg string, args ...interface{})
- func (l *Logger) Log(lvl Level, msg string, fields ...zap.Field)
- func (l *Logger) MQInfoElapsedTime(title string, fields ...zap.Field)
- func (l *Logger) Stacktrace() *Logger
- func (l *Logger) Warn(msg string, fields ...zap.Field)
- func (l *Logger) Warnf(msg string, args ...interface{})
- type Mail
- type Message
- type MsgTags
- type Options
- func WithCaller() Options
- func WithConsole() Options
- func WithDingding(secret, access_token string, level Level, fields ...zap.Field) Options
- func WithFile(fileLogger []FileLogger) Options
- func WithInitialFields(key, value string) Options
- func WithKafka(kafkaLogger []LogKafka) Options
- func WithLevel(level Level) Options
- func WithLogs(fileLogger FilesLogger) Options
- func WithLogsEncoder(fileLogger FilesLogger, enCoder zapcore.Encoder) Options
- func WithMail(mailLogger []Mail) Options
- func WithRocketMQ(rocketmqLogger []LogRocketMQ) Options
- func WithSkip(skip int) Options
- func WithSourceItem(item string) Options
- func WithStacktrace(level Level) Options
- type Robot
- func (robot *Robot) SendLinkMessage(title string, text string, messageUrl string, picUrl string) error
- func (robot *Robot) SendMarkdownMessage(title string, text string, atMobiles []string, isAtAll bool) error
- func (robot *Robot) SendMessage(msg interface{}) error
- func (robot *Robot) SendTextMessage(content string, atMobiles []string, isAtAll bool) error
Constants ¶
View Source
const ( File = "file" //文件路径 Title = "title" //名称 Trans = "Trans" //事务 (列 : 整个视频的调用流程) Action = "Action" //操作 (列 : 具体的功能) Method = "Method" //方法 (列 : 具体的方法) AppID = "AppID" // ServiceCluster = "ServiceCluster" //集群ID ServiceID = "ServiceID" //服务ID ServiceName = "ServiceName" //服务名称 )
Variables ¶
This section is empty.
Functions ¶
func DefaultWithMap ¶
func InitLogZapMQ ¶
func InitLogZapMQ(path string)
func NewRocketMQCore ¶
func NewRocketMQCore(enc zapcore.Encoder, topic string, MqProducer *rocketmq.MqProducer, enab zapcore.LevelEnabler) zapcore.Core
NewRocketMQCore creates a Core that writes logs to a WriteSyncer.
Types ¶
type Base ¶
type Base struct { Code string `thrift:"code,1" db:"code" json:"code"` LogType string `thrift:"logType,2" db:"logType" json:"logType"` Level string `thrift:"level,3" db:"level" json:"level"` Source string `thrift:"source,4" db:"source" json:"source"` IP string `thrift:"ip,5" db:"ip" json:"ip"` Trans string `thrift:"trans,6" db:"trans" json:"trans"` TransId string `thrift:"transId,7" db:"transId" json:"transId"` Action string `thrift:"action,8" db:"action" json:"action"` Method string `thrift:"method,9" db:"method" json:"method"` Description string `thrift:"description,10" db:"description" json:"description"` ApiType string `thrift:"apiType,11" db:"apiType" json:"apiType"` ApiUrl string `thrift:"apiUrl,12" db:"apiUrl" json:"apiUrl"` ProtoData string `thrift:"protoData,13" db:"protoData" json:"protoData"` CreateTimestamp string `thrift:"createTimestamp,14" db:"createTimestamp" json:"createTimestamp"` }
type FileLogger ¶
type FilesLogger ¶
type Level ¶
type Level int8
type LogBody ¶
type LogBody struct { LogHeader //测量维度 Measurement string `json:"Measurement,omitempty"` //应用ID AppID string `json:"AppID,omitempty"` ////原始数据 RawData string `json:"-"` //运行时间 (毫秒us) //耗时(毫秒us) ElapsedTime time.Duration `json:"ElapsedTime,omitempty"` Fields []LogField `gorm:"-"` //客户端IP ClientIP string `gorm:"comment:客户端IP" json:"ClientIP,omitempty"` //开始时间 (毫秒时间戳) StartTime string `gorm:"comment:开始时间" json:"StartTime,omitempty"` //结束时间 (毫秒时间戳) EndTime string `gorm:"comment:结束时间" json:"EndTime,omitempty"` TimeUsed int64 TimeUsedType string }
type LogDingding ¶
type LogDingding struct {
// contains filtered or unexported fields
}
LogDingding .
type LogHeader ¶
type LogHeader struct { //ID (雪花算法) ID int64 `gorm:"type:bigint(20);primaryKey;comment: 自增 ID" json:"ID,omitempty"` //事务ID (雪花算法) TransId int64 `json:"TransId,omitempty"` //集群ID ServiceCluster string `json:"ServiceCluster,omitempty"` //服务ID ServiceID string `json:"ServiceID,omitempty"` //服务名 ServiceName string `json:"ServiceName,omitempty"` //名称 Title string `json:"title"` Level string `json:"level,omitempty"` //级别 (Debug, Info, Warn, Error, Panic, Fatal) Time string `json:"time"` //时间 File string `json:"file,omitempty"` // Msg string `json:"msg"` //事务 (列 : 整个视频的调用流程) Trans string `json:"Trans,omitempty"` //操作 (列 : 具体的功能) Action string `json:"Action,omitempty"` //方法 (列 : 具体的方法) Method string `json:"Method,omitempty"` //数据类型(QPS/服务/事件) DataType string `json:"DataType,omitempty"` CreateTime time.Duration `json:"CreateTime,omitempty"` }
type LogKafka ¶
type LogKafka struct { Topic string Address []string Level *Level // contains filtered or unexported fields }
LogKafka 写入kafka
type LogQuery ¶
type LogQuery struct { TransId string `json:"TransId,omitempty"` //事务ID (雪花算法) Trans string `json:"Trans,omitempty"` //事务 Level string `json:"omitempty"` //级别 (Debug, Info, Warn, Error, Panic, Fatal) Bucket string `json:"Bucket,omitempty"` Measurement string `json:"Measurement,omitempty"` //测量维度 StartTime int64 `json:"StartTime,omitempty"` //开始时间 (毫秒时间戳) EndTime int64 `json:"EndTime,omitempty"` //结束时间 (毫秒时间戳) LastTime string `json:"LastTime,omitempty"` //最近时间 (-2d/天;-5m/分钟) ServiceID string `json:"ServiceID,omitempty"` //服务ID ServiceName string `json:"ServiceName,omitempty"` //服务名 AppID string `json:"AppID,omitempty"` //应用ID ClientIP string `json:"ClientIP,omitempty"` //客户端IP }
type LogRocket ¶
type LogRocket struct { Topic string Group string Tag string Key string *rocketmq.MqProducer LogBody }
func NewProbeLog ¶
NewProbeLog 初始化 数据探针
type LogRocketMQ ¶
type LogStatistic ¶
type Logger ¶
type Logger struct { Kafka string File string SourceItem string // contains filtered or unexported fields }
logger .
func NewWithMap ¶
NewWithMap new with map
func (*Logger) MQInfoElapsedTime ¶
MQInfoElapsedTime 统计耗时
type Mail ¶
type Mail struct { Level *Level From string To string Subject string Stmp string Port int Password string // contains filtered or unexported fields }
Mail 发送邮件
type Message ¶
type Message struct { Msg string `json:"msg"` Level string `json:"level"` TimeKey string `json:"time"` CallerKey string `json:"file"` ServiceName string `json:"serviceName"` Location string `json:"location"` Other interface{} `json:"detail"` }
Message
type Options ¶
type Options func(l *Logger)
Options .
func WithConsole ¶
func WithConsole() Options
func WithDingding ¶
func WithLogsEncoder ¶
func WithLogsEncoder(fileLogger FilesLogger, enCoder zapcore.Encoder) Options
WithLogs 开启写入单个文件 并且制定enCider
func WithSourceItem ¶
func WithStacktrace ¶
type Robot ¶
type Robot struct {
// contains filtered or unexported fields
}
func (*Robot) SendLinkMessage ¶
func (*Robot) SendMarkdownMessage ¶
func (*Robot) SendMessage ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.