logger

package
v0.1.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, message string, fields ...Field)

for caller

func Error

func Error(ctx context.Context, message string, fields ...Field)

func Fatal

func Fatal(ctx context.Context, message string, fields ...Field)

func Info

func Info(ctx context.Context, message string, fields ...Field)

func InitErc added in v0.1.2

func InitErc()

func InitLogger added in v0.0.3

func InitLogger(name, application, environment, alias, std string)

logger init

func Warn

func Warn(ctx context.Context, message string, fields ...Field)

Types

type Attribute added in v0.0.4

type Attribute struct {
	Log      Log                    `json:"log"`
	Duration Duration               `json:"duration"`
	Param    map[string]interface{} `json:"param"`
	Output   map[string]interface{} `json:"output"`
}

type Duration added in v0.0.6

type Duration struct {
	Runtime      int64 `json:"runtime"` // 运行耗时
	ConsumeDelay int64 `json:"delay"`   // 消费延迟
}

type Encoder

type Encoder = zapcore.Encoder

type EncoderConfig

type EncoderConfig = zapcore.EncoderConfig

type Erc added in v0.1.2

type Erc struct {
	Name  string
	Code  int
	Level string
	Label string
}

func GetDefaultErc added in v0.1.2

func GetDefaultErc() Erc

func GetErc added in v0.1.2

func GetErc(name string, label string) Erc

func GetErcBaseCode added in v0.1.8

func GetErcBaseCode(code int) Erc

type Field

type Field = zapcore.Field

type Level

type Level = zapcore.Level

type Log added in v0.0.4

type Log struct {
	Final bool   `json:"final"` // 是否为代码段日志
	Level string `json:"level"` // 数据层面的日志级别
	Code  int    `json:"code"`
}

type Logger

type Logger interface {
	Debug(ctx context.Context, message string, fields ...Field)
	Info(ctx context.Context, message string, fields ...Field)
	Warn(ctx context.Context, message string, fields ...Field)
	Error(ctx context.Context, message string, fields ...Field)
	Fatal(ctx context.Context, message string, fields ...Field)
}

logger interface

func NewZapLogger

func NewZapLogger(application, environment, label, std string) Logger

new logger base zap

type ZapLogger

type ZapLogger struct {
	Logger *zap.Logger
	Env    string
	App    string
	Label  string
	// contains filtered or unexported fields
}

func (*ZapLogger) Debug

func (c *ZapLogger) Debug(ctx context.Context, message string, fields ...Field)

function of zap logger

func (*ZapLogger) Error

func (c *ZapLogger) Error(ctx context.Context, message string, fields ...Field)

func (*ZapLogger) Fatal

func (c *ZapLogger) Fatal(ctx context.Context, message string, fields ...Field)

func (*ZapLogger) Info

func (c *ZapLogger) Info(ctx context.Context, message string, fields ...Field)

func (*ZapLogger) Warn

func (c *ZapLogger) Warn(ctx context.Context, message string, fields ...Field)

func (*ZapLogger) Writer

func (c *ZapLogger) Writer(ctx context.Context, level string, message string, fields ...Field)

write message

Jump to

Keyboard shortcuts

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