glogger

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 7 Imported by: 0

README

MSLoggger

基于ZAP封装的日志库

Documentation

Index

Constants

View Source
const (
	RequestID  string = "requestId"
	PlatformID string = "platformId"
	UserFlag   string = "userflag"
	Duration   string = "duration"
	Size       string = "size"
	UserAgent  string = "userAgent"
	Referer    string = "referer"
	Method     string = "method"
	Url        string = "url"
	ServerIP   string = "serverip"
	SourceIP   string = "sourceip"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

func Error

func Error(msg string, fields ...zap.Field)

func Info

func Info(msg string, fields ...zap.Field)

func WithDebug added in v0.1.3

func WithDebug(ctx *context.Context, msg string, fields ...zap.Field)

func WithError added in v0.1.3

func WithError(ctx *context.Context, msg string, fields ...zap.Field)

func WithInfo added in v0.1.3

func WithInfo(ctx *context.Context, msg string, fields ...zap.Field)

Types

type FormatTemplateWithor added in v0.1.2

type FormatTemplateWithor interface {
}

type GLogger

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

func CreateLog

func CreateLog(gconfig GLoggerConfig) GLogger

func WithContext

func WithContext(ctx *context.Context) GLogger

func (GLogger) Debug

func (log GLogger) Debug(msg string, fields ...zap.Field)

func (GLogger) Error

func (log GLogger) Error(msg string, fields ...zap.Field)

func (GLogger) Errorf

func (log GLogger) Errorf(msg string, args ...interface{})

func (GLogger) Info

func (log GLogger) Info(msg string, fields ...zap.Field)

func (GLogger) Infof

func (log GLogger) Infof(msg string, args ...interface{})

func (GLogger) SetContext added in v0.1.2

func (log GLogger) SetContext(ctx *context.Context) GLogger

func (GLogger) Warnf

func (log GLogger) Warnf(msg string, args ...interface{})

func (GLogger) With

func (log GLogger) With(fields ...zap.Field) GLogger

func (GLogger) WithDebug added in v0.1.3

func (log GLogger) WithDebug(ctx *context.Context, msg string, fields ...zap.Field)

func (GLogger) WithError added in v0.1.3

func (log GLogger) WithError(ctx *context.Context, msg string, fields ...zap.Field)

func (GLogger) WithErrorf added in v0.1.3

func (log GLogger) WithErrorf(ctx *context.Context, msg string, args ...interface{})

func (GLogger) WithInfo added in v0.1.3

func (log GLogger) WithInfo(ctx *context.Context, msg string, fields ...zap.Field)

func (GLogger) WithInfof added in v0.1.3

func (log GLogger) WithInfof(ctx *context.Context, msg string, args ...interface{})

func (GLogger) WithWarnf added in v0.1.3

func (log GLogger) WithWarnf(ctx *context.Context, msg string, args ...interface{})

func (GLogger) Withf added in v0.1.2

func (log GLogger) Withf(args []interface{}) *zap.SugaredLogger

TODO 待优化,既然格式一定,是不是可以暂时直接写死

type GLoggerConfig added in v0.1.2

type GLoggerConfig struct {
	OutputPath string
	Level      zapcore.Level
}

type LogPayload added in v0.1.3

type LogPayload struct {
	RequestID  string
	UserFlag   string
	PlatformID string
	Duration   string
	Size       int64
	UserAgent  string
	Referer    string
	Method     string
	Url        string
	ServerIP   string
	SourceIP   string
}

Directories

Path Synopsis
core

Jump to

Keyboard shortcuts

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