Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelKey = "level" LoggerKey = "logger" KindKey = "kind" ComponentKey = "component" )
Variables ¶
This section is empty.
Functions ¶
func RegisterLevelName ¶
RegisterLevelName register the name of one level. If the level is already exists, the function will overwrite it. If the name given is empty, it register nothing, or it deregister a level name.
func UseManager ¶
func UseManager(mng Manager)
Types ¶
type Level ¶
type Level int8
A Level is a logging priority. Higher levels are more important.
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel // ClosedLevel logs output nothing. ClosedLevel = math.MaxInt8 )
type Logger ¶
type Logger interface { LevelEnabled(level Level) bool Printer() Printer Name() string AtLevel(level Level) Printer }
Logger represents a logger that can provide Printers.
type Manager ¶
Manager represents a Logger manager. It provide Loggers by logger name.
func GetManager ¶
type Printer ¶
type Printer interface { Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) With(key string, value interface{}) Printer }
Printer represents a stateful printer that is at specific level, carries fields including logger name. A Printer is usually got from a Logger and left/throw away after do print.
Click to show internal directories.
Click to hide internal directories.