beego

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBeegoLogger

func CreateBeegoLogger(opt *Options) *logs.BeeLogger

func IfString

func IfString()

func InstallOptionsWatchDog

func InstallOptionsWatchDog(dog func(cc *Options))

func Int2String

func Int2String(a int) string

Types

type BIMsg

type BIMsg struct {
	EventId     string //事件ID
	ProjectId   string `json:"project_id" valid:"required"` //bi分配的项目组项目id
	ClientId    string `json:"client_id" valid:"required"`  //服务项目的clientid
	DeviceId    string `json:"device_id" valid:"optional"`  //用户的设备original_deviceid
	UserId      string `json:"user_id" valid:"optional"`    //用户id
	Type        string `json:"type" valid:"required"`       //ga事件类型。有game、coin、login、pay、push、track、profile
	ErrorCode   string `json:"err_code" valid:"optional"`   //错误码 如果正常事件 ErrorCode=0
	ErrorMsg    string `json:"err_msg" valid:"optional"`    //错误信息
	ErrorReport string //错误描述,由程序员书写,概述错误可能导
	// 致的问题以及解决方案
	Properties map[string]string `json:"properties"  valid:"optional"` //事件的额外补充,必须是string:string格式的map
	Lib        map[string]string `json:"lib" valid:"optional"`         //服务器版本信息,也必须是string:string格式的map
}

type BeegoLogger

type BeegoLogger struct {
	Option *Options

	Trace *Trace
	Msg   string
	Level wlog.Level
	// contains filtered or unexported fields
}

func New

func New(opts *Options) *BeegoLogger

New creates a new

func NewGa

func NewGa(opts *Options) *BeegoLogger

NewGa 初始化Ga逻辑

func (*BeegoLogger) Info

func (bee *BeegoLogger) Info(level wlog.Level, msg string, data wlog.TYFields)

Info 输出日志格式

func (*BeegoLogger) MustInstallGa

func (bee *BeegoLogger) MustInstallGa(projectID, clientID string)

MustInstallGa Ga日志必选参数

func (*BeegoLogger) SetLevel

func (bee *BeegoLogger) SetLevel(level wlog.Level)

SetLevel 设置日志输出级别

func (*BeegoLogger) WithFilter

func (bee *BeegoLogger) WithFilter()

WithFilter 过滤字段

type ContextParam

type ContextParam struct {
	IP         string `json:"ip"`
	UserAgent  string `json:"user_agent"`
	Path       string `json:"path"`
	Method     string `json:"method"`
	Proto      string `json:"proto"`
	Status     int    `json:"status"`
	AccessId   string `json:"access_id"`
	SignType   string `json:"sign_type"`
	SecretType string `json:"secret_type"`
	Random     string `json:"random"`
	Timestamp  string `json:"timestamp"`
	Signature  string `json:"signature"`

	//session
	ServerId  string `json:"server_id"`
	Topic     string `json:"topic"`
	UserId    string `json:"user_id"`
	SessionId string `json:"session_id"`
	ClientId  string `json:"client_id" valid:"required"` //服务项目的clientid
	DeviceId  string `json:"device_id" valid:"optional"` //用户的设备original_deviceid
}

type LogMsg

type LogMsg struct {
	EventId     string
	SubEventId  string
	ErrorMsg    string
	ErrorReport string
	EventParams interface{}
	Rparam      interface{}
}

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger 日志对象

func CreateLogger

func CreateLogger(trace, span string) *Logger

func GetLogger

func GetLogger(ctx echo.Context) *Logger

GetLogger 获取 Logger 对象

func GetLoggerWithSession added in v1.0.3

func GetLoggerWithSession(session gate.Session) *Logger

GetLogger 获取 Logger 对象

func GetRootLogger

func GetRootLogger() *Logger

func Newlogger

func Newlogger(msg string) *Logger

Newlogger创建一个logger

func (*Logger) BiReport

func (logger *Logger) BiReport(msg BIMsg)

func (*Logger) Debugf

func (logger *Logger) Debugf(format string, a ...interface{})

Debugf 调试格式化打印

func (*Logger) Errorf

func (logger *Logger) Errorf(format string, a ...interface{})

Errorf 错误格式化打印

func (*Logger) Infof

func (logger *Logger) Infof(format string, a ...interface{})

Infof 重要信息格式化打印

func (*Logger) JDebug

func (logger *Logger) JDebug(msg LogMsg)

Debugf 调试格式化打印

func (*Logger) JError

func (logger *Logger) JError(msg LogMsg)

Errorf 错误格式化打印

func (*Logger) JInfo

func (logger *Logger) JInfo(msg LogMsg)

Infof 重要信息格式化打印

func (*Logger) JWarn

func (logger *Logger) JWarn(msg LogMsg)

Warnf 警告格式化打印

func (*Logger) Warnf

func (logger *Logger) Warnf(format string, a ...interface{})

Warnf 警告格式化打印

type Option

type Option func(cc *Options) Option

func WithDaily

func WithDaily(v bool) Option

func WithDebug

func WithDebug(v bool) Option

func WithFilename

func WithFilename(v string) Option

func WithLevel

func WithLevel(v int) Option

func WithMaxDays

func WithMaxDays(v int) Option

func WithMaxlines

func WithMaxlines(v int) Option

func WithMaxsize

func WithMaxsize(v int) Option

func WithPerm

func WithPerm(v string) Option

func WithRotate

func WithRotate(v bool) Option

func WithSeparate

func WithSeparate(v ...string) Option

type Options

type Options struct {
	Filename string   `json:"filename"`
	Maxlines int      `json:"maxline"`
	Maxsize  int      `json:"maxsize"`
	Daily    bool     `json:"daily"`
	MaxDays  int      `json:"maxdays"`
	Rotate   bool     `json:"rotate"`
	Level    int      `json:"level"`
	Perm     string   `json:"perm"`
	Separate []string `json:"separate"`
	Debug    bool
}

func NewOptions

func NewOptions(opts ...Option) *Options

func (*Options) ApplyOption

func (cc *Options) ApplyOption(opts ...Option)

func (*Options) GetSetOption

func (cc *Options) GetSetOption(opt Option) Option

func (*Options) SetOption

func (cc *Options) SetOption(opt Option)

type Trace

type Trace struct {
	*logs.BeegoTraceSpan
}

Jump to

Keyboard shortcuts

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