Documentation ¶
Overview ¶
Package ilog provides a simple and lightweight logging framework for involucro. It is a Go-lang-y abbreviation for involucro logging.
All public methods in this package are thread-safe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Debug is a level not printed by default with prefix "DEBU". Debug = ForLevelPrefix(-2, "DEBU") // Info is a level not printed by default with prefix "INFO". Info = ForLevelPrefix(-1, "INFO") // Warn is a level printed by default with prefix "WARN". Warn = ForLevelPrefix(0, "WARN") // Error is a level printed by default with prefix "ERRO". Error = ForLevelPrefix(1, "ERRO") )
var StdLog = New()
StdLog is the default logger that is available in the global space.
Functions ¶
func ColorfulPrintFunc ¶
func ColorfulPrintFunc(b Bough)
ColorfulPrintFunc is a PrintFunc that formats the Bough nicely with colors (if supported).
Types ¶
type Ilog ¶
type Ilog struct {
// contains filtered or unexported fields
}
Ilog is the context for all loggers. There is a default instance which is sufficient for most use cases.
func (*Ilog) ForLevelPrefix ¶
ForLevelPrefix gives a logger for level l and prefix p.
func (*Ilog) MinPrintLevel ¶
MinPrintLevel returns the minimum required print level.
func (*Ilog) Send ¶
Send handles a Bough and delivers it to the print function if the level of the bough is at least the minimum print level.
func (*Ilog) SetMinPrintLevel ¶
SetMinPrintLevel sets the minimum required level for a Bough to be actually printed. Level 2 messages are only printed if the level is 2 or lower.
func (*Ilog) SetPrintFunc ¶
SetPrintFunc replaces the print function with f.
type Logger ¶
type Logger interface { Logln(a ...interface{}) Logf(f string, a ...interface{}) // contains filtered or unexported methods }
Logger provides functionality to log strings. It provides a ln variant which works like Sprint, and a f variant like Sprintf.
func ForLevelPrefix ¶
ForLevelPrefix gives a Logger that logs with level l and prefix p. It logs on the default logging context.