log

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentLength added in v0.1.1

func ContentLength(rq *http.Request) int

ContentLength returns content length previously pushed into the request context. Returns 0 if no content length was pushed.

func Debug

func Debug(rq *http.Request, msg string, fields ...zap.Field)

Debug emits debug level message using server logger associated with the request.

func DefaultAccessLogEncoderConfig

func DefaultAccessLogEncoderConfig() zapcore.EncoderConfig

DefaultAccessLogEncoderConfig returns the default configuration for access logger encoder

func DefaultServerLogEncoderConfig

func DefaultServerLogEncoderConfig() zapcore.EncoderConfig

DefaultServerLogEncoderConfig returns the default configuration for server logger encoder

func Error

func Error(rq *http.Request, msg string, fields ...zap.Field)

Error emits error level message using server logger associated with the request.

func Fatal

func Fatal(rq *http.Request, msg string, fields ...zap.Field)

Fatal emits fatal level message using server logger associated with the request.

func Info

func Info(rq *http.Request, msg string, fields ...zap.Field)

Info emits info level message using server logger associated with the request.

func Log

func Log(next http.Handler) http.Handler

Log is the convenience wrapper around Middleware

func Logger

func Logger(rq *http.Request) *zap.Logger

Logger returns server logger associated with the request. If there's no logger associated with the request, returns no-op logger.

func Middleware

func Middleware(aw io.Writer, sw io.Writer, lvl zapcore.Level) func(http.Handler) http.Handler

Middleware is logging middleware constructor

func Named

func Named(rq *http.Request, s string)

Named append name token to both server and access loggers associated with the request.

func Panic

func Panic(rq *http.Request, msg string, fields ...zap.Field)

Panic emits panic level message using server logger associated with the request.

func Sequence added in v0.1.2

func Sequence(rq *http.Request) uint64

Sequence returns request sequence from the request context. Returns 0 if not found in the context.

func StatusCode added in v0.1.1

func StatusCode(rq *http.Request) int

StatusCode returns status code previously pushed into the request context. Returns 0 if no status was pushed.

func UID added in v0.1.2

func UID(rq *http.Request) uuid.UUID

UID returns request identifier from the request context. Returns zero UUID if not found in the context.

func Warn

func Warn(rq *http.Request, msg string, fields ...zap.Field)

Warn emits warn level message using server logger associated with the request.

func With

func With(rq *http.Request, fields ...zap.Field)

With pushes the lest of fields into the context of both access and server loggers associated with the request.

func WithContentLength

func WithContentLength(rq *http.Request, n int)

WithContentLength pushes response content length into the access logger associated with the request.

func WithStatusCode added in v0.1.1

func WithStatusCode(rq *http.Request, status int)

WithStatusCode pushes response status code into the access logger associated with the request.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL