Documentation ¶
Overview ¶
Package log15 provides a Log15 binding for Scribe.
Example ¶
binding := Bind(WithContext(log15.Root())) s := scribe.New(binding.Factories()) // Do some logging s.I()("Important application message") // Eventually, when the logger is no longer required... err := binding.Close() if err != nil { panic(err) }
Output:
Index ¶
Examples ¶
Constants ¶
const KeyErr = "Err"
KeyErr is used to key Scene.Err into the custom context.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding interface { Factories() scribe.LoggerFactories Close() error }
Binding captures the state of the binding, including the underlying logger instance. The binding must be closed when the logger is no longer required.
func Bind ¶
func Bind(ctor Constructor, dtor ...Destructor) Binding
Bind makes a new Log15 binding using the given constructor to create the underlying Log15 logger. The returned binding must be closed after the logger is no longer required. The closing of the logger is delegated to an optional destructor. The destructor will typically close any handlers that require explit disposal.
This implementation uses shimming to realise the binding, having compensated for the call stack depth with the underlying logger.
type Constructor ¶
Constructor is a way of creating a Log15 logger.
func WithContext ¶
func WithContext(parent log15.Logger, ctx ...interface{}) Constructor
WithContext returns a constructor for creating a Log15 logger from the given parent logger and additional context.
func WithHandler ¶
func WithHandler(ctor Constructor, handler log15.Handler) Constructor
WithHandler wraps a given constructor to inject the given handler to a newly created Log15 logger before returning it to the caller.
type Destructor ¶
Destructor provides a way of cleaning up
type FullFormat ¶
type FullFormat struct{}
FullFormat prints all fields in a log record. Useful for debugging.