log

package
Version: v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: AGPL-3.0 Imports: 10 Imported by: 61

Documentation

Index

Constants

View Source
const (
	// PropertyKeySessionID is the session id of current logger
	PropertyKeySessionID = "SessionID"
	// PropertyKeyContextID is the context id of current logger
	PropertyKeyContextID = "ContextID"
	// PropertyKeyUserID is the user id of current logger
	PropertyKeyUserID = "UserID"
	// PropertyKeyTenantID is the tenant id of current logger
	PropertyKeyTenantID = "TenantID"
	// PropertyKeyTag is the tag of current logger
	PropertyKeyTag = "Tag"
)

Variables

View Source
var CurrentLevel = parseLevel(strings.ToUpper(env.Config.Log.Level))

Functions

func Debug added in v0.18.1

func Debug(ctx context.Context, message string)

func Debugf added in v0.18.1

func Debugf(ctx context.Context, message string, props dto.Props)

func Error added in v0.18.1

func Error(ctx context.Context, err error)

func Errorf added in v0.18.1

func Errorf(ctx context.Context, message string, props dto.Props)

func GetProperties added in v0.18.1

func GetProperties(ctx context.Context) dto.Props

func GetProperty added in v0.18.1

func GetProperty(ctx context.Context, key string) interface{}

func Info added in v0.18.1

func Info(ctx context.Context, message string)

func Infof added in v0.18.1

func Infof(ctx context.Context, message string, props dto.Props)

func IsEnabled added in v0.18.1

func IsEnabled(level Level) bool

func Parse added in v0.14.0

func Parse(format string, props dto.Props, colorize bool) string

Parse is used to merge props into format and return a text message

func Warn added in v0.18.1

func Warn(ctx context.Context, message string)

func Warnf added in v0.18.1

func Warnf(ctx context.Context, message string, props dto.Props)

func WithProperties added in v0.18.1

func WithProperties(ctx context.Context, kv dto.Props) context.Context

func WithProperty added in v0.18.1

func WithProperty(ctx context.Context, key string, value interface{}) context.Context

Types

type Level

type Level uint8

Level defines all possible log levels

const (
	// DEBUG for verbose logs
	DEBUG Level = iota + 1
	// INFO for WARN+ERROR+INFO logs
	INFO
	// WARN for WARN+ERROR logs
	WARN
	// ERROR for ERROR only logs
	ERROR
	// NONE is used to disable logs
	NONE
)

func (Level) String added in v0.14.0

func (l Level) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL