log

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDepth int = 4
)

Variables

This section is empty.

Functions

func Init

func Init() error

Types

type Configure

type Configure struct {
	types.AutoConfigure `prefix:"application.logging"`
	Level               string     `json:"level" yaml:"level"`
	Instance            string     `json:"instance" yaml:"instance"`
	SkipIndex           int        `json:"skip_index" yaml:"skip_index"`
	Style               *Style     `json:"style" yaml:"style"`
	Loggers             []*Loggers `json:"loggers" yaml:"loggers"`
}

type ILoggerFactory

type ILoggerFactory interface {
	GetLogger(name string) LoggerAdapter
}

type Level

type Level int
const (
	Trace Level = iota
	Debug
	Info
	Warn
	Error
	Panic
	Fatal
)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	Context(ctx context.Context) Logger

	Trace(format string, a ...interface{})

	Debug(format string, a ...interface{})

	Info(format string, a ...interface{})

	Warn(format string, a ...interface{})

	Error(format string, a ...interface{})

	Panic(format string, a ...interface{})

	Fatal(format string, a ...interface{})
}

func GetLog

func GetLog() Logger

func New

func New(logger LoggerAdapter, conf *Configure, depth int) (Logger, error)

type LoggerAdapter

type LoggerAdapter interface {
	SetLevel(level Level)

	Trace(a string, meta *Meta)

	Debug(a string, meta *Meta)

	Info(a string, meta *Meta)

	Warn(a string, meta *Meta)

	Error(a string, meta *Meta)

	Panic(a string, meta *Meta)

	Fatal(a string, meta *Meta)
}

type LoggerFacade

type LoggerFacade struct {
	Ctx    context.Context
	Logger LoggerAdapter
	Conf   *Configure
	// contains filtered or unexported fields
}

func (*LoggerFacade) Context

func (l *LoggerFacade) Context(ctx context.Context) Logger

func (*LoggerFacade) Debug

func (l *LoggerFacade) Debug(format string, a ...interface{})

func (*LoggerFacade) Error

func (l *LoggerFacade) Error(format string, a ...interface{})

func (*LoggerFacade) Fatal

func (l *LoggerFacade) Fatal(format string, a ...interface{})

func (*LoggerFacade) Info

func (l *LoggerFacade) Info(format string, a ...interface{})

func (*LoggerFacade) Panic

func (l *LoggerFacade) Panic(format string, a ...interface{})

func (*LoggerFacade) Trace

func (l *LoggerFacade) Trace(format string, a ...interface{})

func (*LoggerFacade) Warn

func (l *LoggerFacade) Warn(format string, a ...interface{})

type LoggerFactory

type LoggerFactory struct {
	Conf          *Configure
	LoggerFactory ILoggerFactory `wire:""`
}

type Loggers added in v1.3.8

type Loggers struct {
	Name  string `json:"name" yaml:"name"`
	Level string `json:"level" yaml:"level"`
}

type Meta added in v1.3.8

type Meta struct {
	Ctx       context.Context
	Frame     *runtime.Frame
	Level     Level
	Timestamp time.Time
}

type Spec

type Spec struct {
	Layout string `json:"layout" yaml:"layout"`
	Color  int
}

type Style added in v1.3.8

type Style struct {
	Spec     map[string]*Spec `json:"spec" yaml:"spec"`
	Template []string         `json:"template" yaml:"template"`
}

Jump to

Keyboard shortcuts

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