log

package
v0.0.0-...-80164ef Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldErrKey       = "error"
	FieldComponentKey = "component"
	FieldFilenameKey  = "filename"
)
View Source
const (
	RequestIDCtxKey = "requestID"
)

Variables

View Source
var Levels = LevelEnum{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type Data

type Data struct {
	Ctx    context.Context
	Msg    string
	Fields []*Field
	Level  Level
}

func DebugData

func DebugData(ctx context.Context, msg string) *Data

func ErrorData

func ErrorData(ctx context.Context, msg, err string) *Data

func InfoData

func InfoData(ctx context.Context, msg string) *Data

func WarnData

func WarnData(ctx context.Context, msg string) *Data

type Field

type Field struct {
	Key     string
	Integer int
	Float   float64
	String  string
	Object  interface{}
}

type Level

type Level int8

type LevelEnum

type LevelEnum map[int8]Level

func (LevelEnum) Debug

func (e LevelEnum) Debug() Level

func (LevelEnum) Error

func (e LevelEnum) Error() Level

func (LevelEnum) Fatal

func (e LevelEnum) Fatal() Level

func (LevelEnum) Info

func (e LevelEnum) Info() Level

func (LevelEnum) Warn

func (e LevelEnum) Warn() Level

type Logger

type Logger interface {
	LogError(ctx context.Context, errs ...error)
	LogWarn(ctx context.Context, messages ...string)
	LogInfo(ctx context.Context, messages ...string)
	LogDebug(ctx context.Context, messages ...string)
}

type ZapLogger

type ZapLogger struct {
	*zap.Logger
}

func NewZapLogger

func NewZapLogger(appID string) *ZapLogger

func (*ZapLogger) LogDebug

func (l *ZapLogger) LogDebug(ctx context.Context, messages ...string)

func (*ZapLogger) LogError

func (l *ZapLogger) LogError(ctx context.Context, errs ...error)

func (*ZapLogger) LogInfo

func (l *ZapLogger) LogInfo(ctx context.Context, messages ...string)

func (*ZapLogger) LogWarn

func (l *ZapLogger) LogWarn(ctx context.Context, messages ...string)

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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