log

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: LGPL-3.0 Imports: 16 Imported by: 7

Documentation

Index

Constants

View Source
const (
	TxEvent        = "[tx]"
	ConsensusEvent = "[consensus]"
	NetworkEvent   = "[network]"
)
View Source
const (
	RotateLogSize = 64 * 1024 * 1024 // 64M
	BackUpCount   = 19               // 滚动日志文件数
)
View Source
const (
	LevelCrit  = log15.LvlCrit
	LevelError = log15.LvlError
	LevelWarn  = log15.LvlWarn
	LevelInfo  = log15.LvlInfo
	LevelDebug = log15.LvlDebug
)

Variables

This section is empty.

Functions

func Crit

func Crit(msg string, ctx ...interface{})

func Critf

func Critf(format string, values ...interface{})

func Debug

func Debug(msg string, ctx ...interface{})

func Debugf

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

func Error

func Error(msg string, ctx ...interface{})

func Errorf

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

func Event added in v1.4.0

func Event(eventType, msg string, ctx ...interface{})

func Eventf added in v1.4.0

func Eventf(eventType, formatMsg string, values ...interface{})

func FileHandler added in v1.4.0

func FileHandler(logFilePath string, fmtr log15.Format) log15.Handler

FileHandler 写入文件handler

func Info

func Info(msg string, ctx ...interface{})

func Infof

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

func Setup

func Setup(lv log15.Lvl, toFile bool, showCodeLine bool)

Setup change the log config immediately The lv is higher the more logs would be visible

func TerminalFormat

func TerminalFormat(usecolor bool, showCodeLine bool) log15.Format

TerminalFormat formats log records optimized for human readability on a terminal with color-coded level output and terser human friendly timestamp. This format should only be used for interactive programs or while developing.

[TIME] [LEVEL] MESAGE key=value key=value ...

Example:

[May 16 20:58:45] [DBUG] remove route ns=haproxy addr=127.0.0.1:50002

func Warn

func Warn(msg string, ctx ...interface{})

func Warnf

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

func WriteFileHandler added in v1.4.0

func WriteFileHandler(logFilePath string, f *os.File, fmtr log15.Format) log15.Handler

Types

type Lazy

type Lazy = log15.Lazy

Lazy allows you to defer calculation of a logged value that is expensive to compute until it is certain that it must be evaluated with the given filters.

Lazy may also be used in conjunction with a Logger's New() function to generate a child logger which always reports the current value of changing state.

You may wrap any function which takes no arguments to Lazy. It may return any number of values of any type.

type TerminalStringer

type TerminalStringer interface {
	TerminalString() string
}

TerminalStringer is an analogous interface to the stdlib stringer, allowing own types to have custom shortened serialization formats when printed to the screen.

Jump to

Keyboard shortcuts

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