Documentation ¶
Index ¶
- Constants
- func DefaultFormatter(l, m string) string
- func WithFormatter(f func(string, string) string) util.Option
- func WithLevel(s string) util.Option
- func WithLogger(f func(...interface{})) util.Option
- type Instance
- func (i *Instance) Critical(f string)
- func (i *Instance) Criticalf(f string, a ...interface{})
- func (i *Instance) Debug(f string)
- func (i *Instance) Debugf(f string, a ...interface{})
- func (i *Instance) Emit(m interface{})
- func (i *Instance) Info(f string)
- func (i *Instance) Infof(f string, a ...interface{})
Constants ¶
const ( // Debug is the debug log level. Debug = "debug" // Info is the info(rmational) log level. Info = "info" // Critical is the critical log level. Critical = "critical" )
Variables ¶
This section is empty.
Functions ¶
func DefaultFormatter ¶ added in v1.0.0
DefaultFormatter is the default logging instance formatter -- this formatter simply adds colors to the log message based on log level.
func WithFormatter ¶ added in v1.0.0
WithFormatter sets the Formatter function of the logging instance.
func WithLogger ¶ added in v1.0.0
WithLogger appends a logger (a function that accepts an interface) to the Loggers slice of a logging instance.
Types ¶
type Instance ¶ added in v1.0.0
type Instance struct { Level string Formatter func(string, string) string Loggers []func(...interface{}) }
Instance is a simple logging object.
func NewInstance ¶ added in v1.0.0
NewInstance returns a new logging Instance.
func (*Instance) Critical ¶ added in v1.0.0
Critical accepts a Critical level log message with no formatting.
func (*Instance) Criticalf ¶ added in v1.0.0
Criticalf accepts a Critical level log message normal fmt.Sprintf type formatting.
func (*Instance) Debug ¶ added in v1.0.0
Debug accepts a Debug level log message with no formatting.
func (*Instance) Debugf ¶ added in v1.0.0
Debugf accepts a Debug level log message normal fmt.Sprintf type formatting.
func (*Instance) Emit ¶ added in v1.0.0
func (i *Instance) Emit(m interface{})
Emit "emits" a logging message m to all the loggers in the Instance.