log

package
v0.0.0-...-acda5ee Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

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

func Debug(ctx context.Context, message string)

func Debugf

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

func Error

func Error(ctx context.Context, err error)

func Errorf

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

func GetProperties

func GetProperties(ctx context.Context) dto.Props

func GetProperty

func GetProperty(ctx context.Context, key string) any

func Info

func Info(ctx context.Context, message string)

func Infof

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

func IsEnabled

func IsEnabled(level Level) bool

func Parse

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

func Warn(ctx context.Context, message string)

func Warnf

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

func WithProperties

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

func WithProperty

func WithProperty(ctx context.Context, key string, value any) 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

func (l Level) String() string

Jump to

Keyboard shortcuts

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