log

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

Debugf print debug with format.

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

Errorf print error with format.

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, v ...interface{})

Infof print info with format.

func NewContext

func NewContext(ctx context.Context, logger Logger) context.Context

NewContext return a new logger context

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, v ...interface{})

Panicf panic with format.

func Trace

func Trace(args ...interface{})

func Tracef

func Tracef(format string, v ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

Warnf print warning with format.

Types

type Config

type Config struct {
	Level  string `json:"level"`
	Format string `json:"format"`
}

func (Config) Build

func (cfg Config) Build() *logrus.Logger

type Fields

type Fields = map[string]interface{}

Fields is alias of map

type Logger

type Logger interface {
	Infof(string, ...interface{})
	Debugf(string, ...interface{})
	Tracef(string, ...interface{})
	Warnf(string, ...interface{})
	Errorf(string, ...interface{})
	Fatalf(string, ...interface{})
	Panicf(string, ...interface{})

	Info(...interface{})
	Debug(...interface{})
	Trace(...interface{})
	Warn(...interface{})
	Error(...interface{})
	Fatal(...interface{})
	Panic(...interface{})

	WithField(key string, val interface{}) Logger

	WithFields(fields Fields) Logger
}

func FromContext

func FromContext(ctx context.Context) Logger

FromContext get logger form context

func Root

func Root() Logger

Root return default logger instance

func WithContext

func WithContext(ctx context.Context) Logger

WithContext return a logger from the given context

func WithField

func WithField(key string, value interface{}) Logger

func WithFields

func WithFields(fields Fields) Logger

WithFields return a new logger entry with fields

Jump to

Keyboard shortcuts

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