log

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 14 Imported by: 5 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

log

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvHasFluentd added in v1.0.2

func EnvHasFluentd() bool

func SetByCtx

func SetByCtx(ctx context.Context, l Logger) context.Context

func SetByGinCtx

func SetByGinCtx(c *gin.Context, l Logger)

func SetByReq

func SetByReq(req *http.Request, l Logger) *http.Request

Types

type LogHandler added in v1.0.6

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

func (*LogHandler) ErrorHandler added in v1.0.6

func (lh *LogHandler) ErrorHandler(err error, info string) bool

func (*LogHandler) InfoHandler added in v1.0.6

func (lh *LogHandler) InfoHandler(msg string)

func (*LogHandler) SetLogger added in v1.0.6

func (lh *LogHandler) SetLogger(l Logger)

func (*LogHandler) WarnHandler added in v1.0.6

func (lh *LogHandler) WarnHandler(err error, info string) bool

type Logger

type Logger interface {
	Info(string)
	Infof(format string, a ...any)
	Debug(string)
	Debugf(format string, a ...any)
	Warn(string)
	Warnf(format string, a ...any)
	WarnPkg(error)
	Error(string)
	Errorf(format string, a ...any)
	ErrorPkg(error)
	Fatal(string)
	Fatalf(format string, a ...any)
	FatalPkg(error)
	GetLogging() *log.Logger
}

func GetByCtx

func GetByCtx(ctx context.Context) Logger

func GetByGinCtx

func GetByGinCtx(c *gin.Context) Logger

func GetByReq

func GetByReq(req *http.Request) Logger

type LoggerConf

type LoggerConf struct {
	FluentLog *fluentLog `yaml:"fluentd,omitempty"`
}

func NewLogerConfWithFluentd

func NewLogerConfWithFluentd(host string, port int) *LoggerConf

func (*LoggerConf) NewLogger

func (lc *LoggerConf) NewLogger(service, pid string) (Logger, error)

type LoggerDI

type LoggerDI interface {
	NewLogger(service string, pid string) (Logger, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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