logs

package
v0.0.0-...-68d4bda Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOGID = "koala_logid"
)

Variables

View Source
var Module = fx.Module("logger",
	fx.Provide(NewLogger),
)

Functions

func Accessf

func Accessf(ctx context.Context, format string, args ...interface{})

accessf logs a message at level Trace on the standard logger.

func Debugf

func Debugf(ctx context.Context, format string, args ...interface{})

Debugf logs a message at level Debug on the standard logger.

func Errorf

func Errorf(ctx context.Context, format string, args ...interface{})

Errorf logs a message at level Error on the standard logger.

func Fatalf

func Fatalf(ctx context.Context, format string, args ...interface{})

Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.

func Infof

func Infof(ctx context.Context, format string, args ...interface{})

Infof logs a message at level Info on the standard logger.

func Init

func Init(filename string, logLevel string, logger *logrus.Logger) (err error)

func NewField

func NewField(fields Fields) *field

func Panicf

func Panicf(ctx context.Context, format string, args ...interface{})

Panicf logs a message at level Panic on the standard logger.

func Tracef

func Tracef(ctx context.Context, format string, args ...interface{})

Tracef logs a message at level Trace on the standard logger.

func Warnf

func Warnf(ctx context.Context, format string, args ...interface{})

Warnf logs a message at level Warn on the standard logger.

func WithLogId

func WithLogId(ctx context.Context, logId string) context.Context

Types

type Fields

type Fields map[string]interface{}

type Logger

type Logger interface {
	Tracef(ctx context.Context, format string, args ...interface{})
	Debugf(ctx context.Context, format string, args ...interface{})
	Infof(ctx context.Context, format string, args ...interface{})
	Accessf(ctx context.Context, format string, args ...interface{})
	Warnf(ctx context.Context, format string, args ...interface{})
	Errorf(ctx context.Context, format string, args ...interface{})
	Panicf(ctx context.Context, format string, args ...interface{})
	Fatalf(ctx context.Context, format string, args ...interface{})
	WithFields(fields Fields) Logger
}

func NewLogger

func NewLogger(conf *config.Config) Logger

func WithFields

func WithFields(fields map[string]interface{}) Logger

type LoggerImp

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

func (*LoggerImp) Accessf

func (l *LoggerImp) Accessf(ctx context.Context, format string, args ...interface{})

accessf logs a message at level Trace on the standard logger.

func (*LoggerImp) Debugf

func (l *LoggerImp) Debugf(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) Errorf

func (l *LoggerImp) Errorf(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) Fatalf

func (l *LoggerImp) Fatalf(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) Infof

func (l *LoggerImp) Infof(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) Panicf

func (l *LoggerImp) Panicf(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) Tracef

func (l *LoggerImp) Tracef(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) Warnf

func (l *LoggerImp) Warnf(ctx context.Context, format string, args ...interface{})

func (*LoggerImp) WithFields

func (l *LoggerImp) WithFields(fields Fields) Logger

type MyHook

type MyHook struct{}

func (*MyHook) Fire

func (h *MyHook) Fire(entry *logrus.Entry) error

func (*MyHook) Levels

func (h *MyHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳