Documentation ¶
Index ¶
- Constants
- func Crit(msg string, ctx ...interface{})
- func Critf(format string, values ...interface{})
- func Debug(msg string, ctx ...interface{})
- func Debugf(format string, values ...interface{})
- func Error(msg string, ctx ...interface{})
- func Errorf(format string, values ...interface{})
- func Event(eventType, msg string, ctx ...interface{})
- func Eventf(eventType, formatMsg string, values ...interface{})
- func FileHandler(logFilePath string, fmtr log15.Format) log15.Handler
- func Info(msg string, ctx ...interface{})
- func Infof(format string, values ...interface{})
- func Setup(lv log15.Lvl, toFile bool, showCodeLine bool)
- func TerminalFormat(usecolor bool, showCodeLine bool) log15.Format
- func Warn(msg string, ctx ...interface{})
- func Warnf(format string, values ...interface{})
- func WriteFileHandler(logFilePath string, f *os.File, fmtr log15.Format) log15.Handler
- type Lazy
- type TerminalStringer
Constants ¶
const ( TxEvent = "[tx]" ConsensusEvent = "[consensus]" NetworkEvent = "[network]" )
const ( RotateLogSize = 64 * 1024 * 1024 // 64M BackUpCount = 19 // 滚动日志文件数 )
Variables ¶
This section is empty.
Functions ¶
func FileHandler ¶ added in v1.4.0
FileHandler 写入文件handler
func Setup ¶
Setup change the log config immediately The lv is higher the more logs would be visible
func TerminalFormat ¶
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
Types ¶
type 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.