Documentation
¶
Overview ¶
Package logger provides logging facilities with incremental prefixes stored in contexts.
Calls to Print and Println print log to the Target, with all the prefixes stored in the context by previous calls to Push. This provides a convenient facility for log in servers, for which different components may add information to be logged about the current request. The function Constructor is a so-called "middleware" initiating this facility for net/http compatible servers.
Index ¶
- Variables
- func Constructor(next http.Handler) http.Handler
- func New(ctx context.Context) context.Context
- func Print(ctx context.Context, msg ...interface{}) error
- func Printf(ctx context.Context, format string, msg ...interface{}) error
- func Push(ctx context.Context, info ...interface{}) error
- type Printer
Constants ¶
This section is empty.
Variables ¶
var NoLogInfo = errors.New("Log info not found in context")
NoLogInfo is returned when the given context has no log prefix stack.
Functions ¶
func Constructor ¶
Constructor is a so-called net/http "middleware" that initialises a log prefix stack in the request's context and logs the time elapsed for the request.