log

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 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 {
	bean.Component
	Level     string `json:"level" yaml:"level"`
	Instance  string `json:"instance" yaml:"instance"`
	SkipIndex int    `json:"skip_index" yaml:"skip_index"`
	Style     *struct {
		Spec     map[string]*Spec `json:"spec" yaml:"spec"`
		Template []string         `json:"template" yaml:"template"`
	} `json:"style" yaml:"style"`
}

func (*Configure) Prefix

func (l *Configure) Prefix() string

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)

	Debug(a string)

	Info(a string)

	Warn(a string)

	Error(a string)

	Panic(a string)

	Fatal(a string)
}

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
}

type Spec

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

Jump to

Keyboard shortcuts

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