Documentation ¶
Index ¶
- Variables
- func FeishuRobotDetail(msg string, appName ...string)
- func LogInit(noConsole bool) io.Writer
- func LogInitRobot(noConsole, robot bool, appName string) io.Writer
- func PanicHandler()
- func RequestJson(method string, url string, paramBody io.Reader, headerMap map[string]string)
- func SendRobotMessage(content string, talkType, ReceiverId, RobotId int)
- func SendToRobotMessage(appName, msg string, talkType, ReceiverId, RobotId int)
- type Formatter
- type MailAuthHook
- type MailHook
- type MessageParamIM
- type NewMessageParamIM
- type NewRobotTextMessageRequest
- type RobotLog
- type TenantAccessTokenBody
Constants ¶
This section is empty.
Variables ¶
View Source
var AppName string
Functions ¶
func FeishuRobotDetail ¶ added in v1.4.1
func LogInitRobot ¶ added in v1.4.0
本配置处理了三个日志输出,1. 控制台(二选一) 2. all.log 所有日志 (二选一) 3. log文件夹下面的分级日志(一定会输出)
func PanicHandler ¶ added in v1.4.0
func PanicHandler()
https://blog.csdn.net/xia_xing/article/details/80597472 异常处理
func RequestJson ¶ added in v1.3.8
func SendRobotMessage ¶ added in v1.3.8
func SendToRobotMessage ¶ added in v1.4.0
Types ¶
type Formatter ¶
type Formatter struct { // FieldsOrder - default: fields sorted alphabetically FieldsOrder []string // TimestampFormat - default: time.StampMilli = "Jan _2 15:04:05.000" TimestampFormat string // HideKeys - show [fieldValue] instead of [fieldKey:fieldValue] HideKeys bool // NoColors - disable colors NoColors bool // NoFieldsColors - apply colors only to the level, default is level + fields NoFieldsColors bool // NoFieldsSpace - no space between fields NoFieldsSpace bool // ShowFullLevel - show a full level [WARNING] instead of [WARN] ShowFullLevel bool // NoUppercaseLevel - no upper case for level value NoUppercaseLevel bool // TrimMessages - trim whitespaces on messages TrimMessages bool // CallerFirst - print caller info first CallerFirst bool // CustomCallerFormatter - set custom formatter for caller info CustomCallerFormatter func(*runtime.Frame) string }
Formatter - logrus formatter, implements logrus.Formatter
type MailAuthHook ¶ added in v1.3.4
type MailAuthHook struct { AppName string Host string Port int From *mail.Address To *mail.Address Username string Password string }
MailAuthHook to sends logs by email with authentication.
func NewMailAuthHook ¶ added in v1.3.4
func NewMailAuthHook(appname string, host string, port int, from string, to string, username string, password string) (*MailAuthHook, error)
NewMailAuthHook creates a hook to be added to an instance of logger.
func (*MailAuthHook) Fire ¶ added in v1.3.4
func (hook *MailAuthHook) Fire(entry *logrus.Entry) error
Fire is called when a log event is fired.
func (*MailAuthHook) Levels ¶ added in v1.3.4
func (hook *MailAuthHook) Levels() []logrus.Level
Levels returns the available logging levels.
type MailHook ¶ added in v1.3.4
type MailHook struct { AppName string // contains filtered or unexported fields }
MailHook to sends logs by email without authentication.
func NewMailHook ¶ added in v1.3.4
NewMailHook creates a hook to be added to an instance of logger.
type MessageParamIM ¶ added in v1.3.8
type MessageParamIM struct { TalkType int `form:"talk_type" json:"talk_type" binding:"required,oneof=1 2" label:"talk_type"` ReceiverId int `form:"receiver_id" json:"receiver_id" binding:"required,numeric,gt=0" label:"receiver_id"` Text string `form:"text" json:"text" binding:"required,max=3000" label:"text"` RobotId int `form:"robot_id" json:"robot_id" label:"robot_id"` }
type NewMessageParamIM ¶ added in v1.4.0
type NewMessageParamIM struct { Type string `json:"type"` //SenderId int `json:"sender_id"` // TODO 最好传过来,可以标记是极兔助手还是快码机器人。但是总体来说没啥关系。 Content string `json:"content"` QuoteId string `json:"quote_id"` Mentions []interface{} `json:"mentions"` Receiver struct { ReceiverId int `json:"receiver_id"` TalkType int `json:"talk_type"` } `json:"receiver"` }
type NewRobotTextMessageRequest ¶ added in v1.4.0
type NewRobotTextMessageRequest struct { NewMessageParamIM RobotId int `json:"robot_id"` }
type RobotLog ¶ added in v1.3.8
type RobotLog struct {
AppName string
}
func NewRobotLogger ¶ added in v1.3.8
type TenantAccessTokenBody ¶ added in v1.4.1
type TenantAccessTokenBody struct { Code int `json:"code"` Expire int `json:"expire"` RequestTime time.Time Msg string `json:"msg"` TenantAccessToken string `json:"tenant_access_token"` }
var LatestToken TenantAccessTokenBody // 最新的token
Source Files ¶
Click to show internal directories.
Click to hide internal directories.