Documentation ¶
Index ¶
- Variables
- func WithNamespace(namespace string, ctx log.Interface) log.Interface
- type Namespaced
- func (n *Namespaced) Debug(msg string)
- func (n *Namespaced) Debugf(msg string, v ...interface{})
- func (n *Namespaced) Error(msg string)
- func (n *Namespaced) Errorf(msg string, v ...interface{})
- func (n *Namespaced) Fatal(msg string)
- func (n *Namespaced) Fatalf(msg string, v ...interface{})
- func (n *Namespaced) Info(msg string)
- func (n *Namespaced) Infof(msg string, v ...interface{})
- func (n *Namespaced) SetNamespaces(namespaces ...string)
- func (n *Namespaced) Warn(msg string)
- func (n *Namespaced) Warnf(msg string, v ...interface{})
- func (n *Namespaced) WithError(err error) log.Interface
- func (n *Namespaced) WithField(k string, v interface{}) log.Interface
- func (n *Namespaced) WithFields(fields log.Fields) log.Interface
Constants ¶
This section is empty.
Variables ¶
View Source
var NamespaceKey = "namespace"
Functions ¶
Types ¶
type Namespaced ¶
Namespaced is a logger that only logs an entry when the namespace of that entry is enabled
func Wrap ¶
func Wrap(ctx log.Interface, namespaces ...string) *Namespaced
Wrap wraps the logger in a Namespaced logger and enables the specified namespaces. See SetNamespaces for information on how to set the namspaces
func (*Namespaced) Debug ¶
func (n *Namespaced) Debug(msg string)
func (*Namespaced) Debugf ¶
func (n *Namespaced) Debugf(msg string, v ...interface{})
func (*Namespaced) Error ¶
func (n *Namespaced) Error(msg string)
func (*Namespaced) Errorf ¶
func (n *Namespaced) Errorf(msg string, v ...interface{})
func (*Namespaced) Fatal ¶
func (n *Namespaced) Fatal(msg string)
func (*Namespaced) Fatalf ¶
func (n *Namespaced) Fatalf(msg string, v ...interface{})
func (*Namespaced) Info ¶
func (n *Namespaced) Info(msg string)
func (*Namespaced) Infof ¶
func (n *Namespaced) Infof(msg string, v ...interface{})
func (*Namespaced) SetNamespaces ¶
func (n *Namespaced) SetNamespaces(namespaces ...string)
SetNamespaces replaces the set of enabled namespaces The namespaces follow this format: "*" enables all namespaces "a" enables namespace a "-a" disables namespace a (even if "a" or "*" is set) For example:
- SetNamespaces("*", "-foo") enables every namespace but foo
- SetNamespaces("foo") enables only foo
- SetNamespaces() disables all namespaced entries
Note that entries without a namespace will always be logged.
func (*Namespaced) Warn ¶
func (n *Namespaced) Warn(msg string)
func (*Namespaced) Warnf ¶
func (n *Namespaced) Warnf(msg string, v ...interface{})
func (*Namespaced) WithField ¶
func (n *Namespaced) WithField(k string, v interface{}) log.Interface
WithField adds a field to the logger
func (*Namespaced) WithFields ¶
func (n *Namespaced) WithFields(fields log.Fields) log.Interface
WithFields adds multiple fields to the logger
Click to show internal directories.
Click to hide internal directories.