log

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HookVendorFluentd  = "fluentd"
	HookVendorLogstash = "logstash"
)
View Source
const (
	TraceLevel = Level(logrus.TraceLevel)
	DebugLevel = Level(logrus.DebugLevel)
	InfoLevel  = Level(logrus.InfoLevel)
	WarnLevel  = Level(logrus.WarnLevel)
	ErrorLevel = Level(logrus.ErrorLevel)
	FatalLevel = Level(logrus.FatalLevel)
	PanicLevel = Level(logrus.PanicLevel)
)
View Source
const (
	FieldKeyWallet = "wallet"
	FieldKeyModule = "module"
	FieldKeyCID    = "cid"
	FieldKeyPrefix = "prefix"
	FieldKeyEID    = "eid"
)
View Source
const (
	LogTimeLayout = "20060102-15:04:05.000000"
)

Variables

View Source
var Must func(err error)
View Source
var Trace, Print, Debug, Info, Warn, Error, Panic, Fatal func(args ...interface{})
View Source
var Tracef, Printf, Debugf, Infof, Warnf, Errorf, Panicf, Fatalf func(format string, args ...interface{})
View Source
var Traceln, Println, Debugln, Infoln, Warnln, Errorln, Panicln, Fatalln func(args ...interface{})

Functions

func AddForwarder

func AddForwarder(c *ForwarderConfig) error

func NewWriter

func NewWriter(cfg *WriterConfig) (io.Writer, error)

func SetGlobalLogger

func SetGlobalLogger(logger Logger)

Types

type Fields

type Fields logrus.Fields

type ForwarderConfig

type ForwarderConfig struct {
	Vendor     string                 `json:"vendor"`
	Address    string                 `json:"address"`
	Level      string                 `json:"level"`
	Name       string                 `json:"name"`
	TimeFormat string                 `json:"time_format,omitempty"`
	Options    map[string]interface{} `json:"options,omitempty"`
}

func (*ForwarderConfig) HookLevels

func (c *ForwarderConfig) HookLevels() ([]logrus.Level, error)

func (*ForwarderConfig) NetworkAndHostPort

func (c *ForwarderConfig) NetworkAndHostPort(defaultNet string) (network string, hostPort string, err error)

func (*ForwarderConfig) UnmarshalByOptions

func (c *ForwarderConfig) UnmarshalByOptions(v interface{}) error

type HookCreater

type HookCreater func(c *ForwarderConfig) (logrus.Hook, error)

type HookWrapper

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

func (*HookWrapper) Fire

func (h *HookWrapper) Fire(e *logrus.Entry) error

func (*HookWrapper) Levels

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

type Level

type Level int

func ParseLevel

func ParseLevel(s string) (Level, error)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	Print(args ...interface{})
	Printf(format string, args ...interface{})
	Println(args ...interface{})

	Trace(args ...interface{})
	Tracef(format string, args ...interface{})
	Traceln(args ...interface{})

	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Debugln(args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Infoln(args ...interface{})

	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Warnln(args ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Errorln(args ...interface{})

	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Panicln(args ...interface{})

	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Fatalln(args ...interface{})

	Log(level Level, args ...interface{})
	Logf(level Level, format string, args ...interface{})
	Logln(level Level, args ...interface{})

	Must(err error)

	WithFields(Fields) Logger
	SetReportCaller(yn bool)
	SetLevel(lv Level)
	GetLevel() Level
	SetConsoleLevel(lv Level)
	GetConsoleLevel() Level
	SetModuleLevel(mod string, lv Level)
	GetModuleLevel(mod string) Level
	Writer() *io.PipeWriter
	WriterLevel(lv Level) *io.PipeWriter
	SetFileWriter(writer io.Writer) error
	// contains filtered or unexported methods
}

func GlobalLogger

func GlobalLogger() Logger

func New

func New() Logger

func WithFields

func WithFields(fields Fields) Logger

type WriterConfig

type WriterConfig struct {
	Filename   string `json:"filename"`
	MaxSize    int    `json:"maxsize"`
	MaxAge     int    `json:"maxage"`
	MaxBackups int    `json:"maxbackups"`
	LocalTime  bool   `json:"localtime"`
	Compress   bool   `json:"compress"`
}

Jump to

Keyboard shortcuts

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