Documentation ¶
Index ¶
- func ContextWithSink(ctx context.Context, sink *Sink) context.Context
- func Ctx(ctx context.Context) *zerolog.Logger
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Handler() func(http.Handler) http.Handler
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Logger() *zerolog.Logger
- func Output(w io.Writer) *zerolog.Logger
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func ProxyAwareRemote(r *http.Request) string
- func Req(r *http.Request) *zerolog.Logger
- func RequestID(r *http.Request) string
- func RequestIDFromContext(ctx context.Context) string
- func SinkContextTransfer(sourceCtx, targetCtx context.Context) context.Context
- func Stack(ctx context.Context)
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func WithContext(ctx context.Context) context.Context
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithSink ¶ added in v0.1.32
ContextWithSink wraps the given context in a new context with the given Sink stored as value.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf implements logrus Debugf interface
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf implements logrus Errorf interface
func Handler ¶
Handler returns a middleware that handles all of the logging aspects of any incoming http request
func ProxyAwareRemote ¶
ProxyAwareRemote return the most likely remote address
func RequestIDFromContext ¶
RequestIDFromContext returns a unique request id or an empty string if there is none
func SinkContextTransfer ¶ added in v0.1.37
SinkContextTransfer gets the sink from the sourceCtx and returns a new context based on targetCtx with the extracted sink. If no sink is present this is a noop
Types ¶
type Sink ¶ added in v0.1.32
type Sink struct { Silent bool // contains filtered or unexported fields }
Sink respresents a log sink which is used to store logs, created with log.Ctx(ctx), inside the context and use them at a later point in time
func SinkFromContext ¶ added in v0.1.32
SinkFromContext returns the Sink of the given context if it exists
func (*Sink) Pretty ¶ added in v0.1.32
Pretty returns the logs as string while using the zerolog.ConsoleWriter to format them in a human readable way
func (*Sink) ToJSON ¶ added in v0.1.32
ToJSON returns a copy of the currently available logs in the Sink as json formatted []byte.