logger

package
v0.0.0-...-d6a8468 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WithHook bool
	LogHook  Hook
)

Functions

func DecorateLog

func DecorateLog(logger *log.Entry) *log.Entry

Types

type ConfigType

type ConfigType struct {
	Level  string `toml:"level"`
	Format string `toml:"format"`
	Output string `toml:"output"`
}
var Config *ConfigType

type Hook

type Hook interface {
	Levels() []log.Level
	Fire(*log.Entry) error
}

hook

type Log

type Log struct {
	LogEntry *log.Entry `json:"log_entry" plate:"log_entry,mid"`
	// contains filtered or unexported fields
}
var (
	StdLog *Log
)

func NewEmptyLogger

func NewEmptyLogger() *Log

func NewEmptyLoggerWithFields

func NewEmptyLoggerWithFields(fields map[string]interface{}) *Log

func NewLog

func NewLog(entry *log.Entry) *Log

func (*Log) AddDefaultHook

func (logger *Log) AddDefaultHook() *Log

func (*Log) AddHook

func (logger *Log) AddHook(hook Hook) *Log

func (*Log) Debug

func (logger *Log) Debug(args ...interface{})

func (*Log) Debugf

func (logger *Log) Debugf(format string, args ...interface{})

Entry Printf family functions

func (*Log) Error

func (logger *Log) Error(args ...interface{})

func (*Log) Errorf

func (logger *Log) Errorf(format string, args ...interface{})

func (*Log) Fatal

func (logger *Log) Fatal(args ...interface{})

func (*Log) Fatalf

func (logger *Log) Fatalf(format string, args ...interface{})

func (*Log) Info

func (logger *Log) Info(args ...interface{})

func (*Log) Infof

func (logger *Log) Infof(format string, args ...interface{})

func (*Log) Panic

func (logger *Log) Panic(args ...interface{})

func (*Log) Panicf

func (logger *Log) Panicf(format string, args ...interface{})

func (*Log) ReqId

func (logger *Log) ReqId() string

func (*Log) SetFormat

func (logger *Log) SetFormat(format string)

func (*Log) SetLevel

func (logger *Log) SetLevel(level log.Level)

func (*Log) SetLogLevel

func (logger *Log) SetLogLevel(level string)

func (*Log) SetOutput

func (logger *Log) SetOutput(output string)

func (*Log) SetOutputWriter

func (logger *Log) SetOutputWriter(out io.Writer)

SetOutput sets the standard logger output.

func (*Log) Warn

func (logger *Log) Warn(args ...interface{})

func (*Log) Warnf

func (logger *Log) Warnf(format string, args ...interface{})

func (*Log) WithFields

func (logger *Log) WithFields(fields map[string]interface{})

func (*Log) WithFieldsNewLog

func (logger *Log) WithFieldsNewLog(fields map[string]interface{}) (entry *log.Entry)

type LogFields

type LogFields map[string]interface{}

type Logger

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})
	ReqId() string
}

func LoggerFromContext

func LoggerFromContext(c *gin.Context) Logger

Logger function

type Requester

type Requester interface {
	RequestID() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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