Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLogger ¶
func SetLogger(newLogger GenericLogger)
SetLogger sets the internal logger to the one provided
Types ¶
type GenericContext ¶
type GenericContext interface { Field(key string, val interface{}) GenericContext // Actually log the built up log line with the message Log(msg string) }
GenericContext provides a way to add fields to a log event
type GenericLogger ¶
type GenericLogger interface { // Base log types Debug() GenericContext Info() GenericContext Warn() GenericContext Error() GenericContext // Add context like logger.With(NewContext().Field("test", "val")) With(ctx GenericContext) GenericLogger }
GenericLogger is the logger interface that legion uses, you can plug in your own logger as long as your logger implements this interface.
func With ¶
func With(gc GenericContext) GenericLogger
With calls the with method of the registered logger, and returns a logger with those fields attached by default
type ZeroLogContext ¶
type ZeroLogContext struct {
// contains filtered or unexported fields
}
ZeroLogContext meets the interface type and provides context to a log event
func (*ZeroLogContext) Field ¶
func (zlc *ZeroLogContext) Field(key string, val interface{}) GenericContext
Field appends a field to the context
type ZeroLogger ¶
ZeroLogger is a wrapper around zerolog so it can implement our interface
func (*ZeroLogger) Debug ¶
func (zl *ZeroLogger) Debug() GenericContext
Debug calls the debug method of the registered logger
func (*ZeroLogger) Error ¶
func (zl *ZeroLogger) Error() GenericContext
Error calls the error method of the registered logger
func (*ZeroLogger) Info ¶
func (zl *ZeroLogger) Info() GenericContext
Info calls the info method of the registered logger
func (*ZeroLogger) Warn ¶
func (zl *ZeroLogger) Warn() GenericContext
Warn calls the warn method of the registered logger
func (*ZeroLogger) With ¶
func (zl *ZeroLogger) With(gc GenericContext) GenericLogger
With appends the context to a new logger and returns it