glogs

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 31 Imported by: 3

Documentation

Overview

Package glogs is a global internal glogs glogs: this is extend package, use https://github.com/uber-go/zap

Index

Constants

View Source
const (
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelError = "error"
)
View Source
const (
	TraceTypeJaeger = "jaeger"
	TraceTypeZipkin = "zipkin"
)
View Source
const (
	JaegerHeaderKey = jaeger.TraceContextHeaderName
)
View Source
const (
	ZipkinHeaderKey = b3.TraceID
)

Variables

View Source
var DingCh = make(chan *AlarmData, 10)
View Source
var (
	RequestIdKey = "request_id"
)

Functions

func Default

func Default(writer *zap.Logger, level logger.LogLevel) logger.Interface

func Error

func Error(r *http.Request, template string, args ...interface{})

func GetSugar

func GetSugar() *zap.Logger

func GetWriter

func GetWriter(filename string, lc *Config) io.Writer

GetWriter 按天切割按大小切割 filename 文件名 RotationSize 每个文件的大小 MaxAge 文件最大保留天数 RotationCount 最大保留文件个数 RotationTime 设置文件分割时间 RotationCount 设置保留的最大文件数量

func Info

func Info(r *http.Request, template string, args ...interface{})

func InitDing

func InitDing(key, host string)

func InitSugar

func InitSugar(lc *Config) *zap.Logger

func SendDing

func SendDing(d *AlarmData)

func StopSpan

func StopSpan(span Span)

func String

func String(key string, value interface{}) zap.Field

func Warn

func Warn(r *http.Request, template string, args ...interface{})

func WithRequest

func WithRequest(r *http.Request) context.Context

func WithValue

func WithValue(value string) context.Context

Types

type AlarmAt

type AlarmAt struct {
	AtMobiles []string `json:"atMobiles"`
	IsAtAll   bool     `json:"isAtAll"`
}

type AlarmData

type AlarmData struct {
	Title       string                 //报警标题
	Description string                 //报警描述
	Content     map[string]interface{} //kv数据
}

func (*AlarmData) SendAlarm

func (ad *AlarmData) SendAlarm() error

type AlarmMarkdown

type AlarmMarkdown struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

type AlarmMsg

type AlarmMsg struct {
	MsgType  string        `json:"msgtype"`
	Text     AlarmText     `json:"text"`
	Markdown AlarmMarkdown `json:"markdown"`
	At       AlarmAt       `json:"at"`
}

type AlarmText

type AlarmText struct {
	Content string `json:"content"`
}

type Config

type Config struct {
	RotationSize  int64         // 单个文件大小
	RotationCount uint          // 可以保留的文件个数
	RotationTime  time.Duration // 日志分割的时间
	MaxAge        time.Duration // 日志最大保留的天数
	// contains filtered or unexported fields
}

type Field

type Field = zap.Field

type GormCtx

type GormCtx struct {
	context.Context
	// contains filtered or unexported fields
}

func (*GormCtx) String

func (c *GormCtx) String() string

type Span

type Span = opentracing.Span

func StartSpan

func StartSpan(name string) Span

func StartSpanP

func StartSpanP(ctx SpanContext, name string) Span

func StartSpanR

func StartSpanR(r *http.Request, name string) Span

type SpanContext

type SpanContext = opentracing.SpanContext

type Tracer

type Tracer = opentracing.Tracer

Directories

Path Synopsis
Package logger is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.
Package logger is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.

Jump to

Keyboard shortcuts

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