Documentation ¶
Overview ¶
Software Name : Remote Key Server Version: 0.9.0 SPDX-FileCopyrightText: Copyright (c) 2020 Orange SPDX-License-Identifier: MPL-2.0
This software is distributed under the Mozilla Public License 2.0, the text of which is available at https://www.mozilla.org/en-US/MPL/2.0/ or see the "LICENSE" file for more details.
Author: Glenn Feunteun, Celine Nicolas
Index ¶
- func ContextWithLogger(ctx context.Context, entry logrus.FieldLogger) context.Context
- func GetBaseLogger() logrus.FieldLogger
- func MethodNotAllowedLogger() http.HandlerFunc
- func NewLoggerFromContext(ctx context.Context) logrus.FieldLogger
- func NotFoundLogger() http.HandlerFunc
- func SetBaseLogger(l logrus.FieldLogger)
- func WithResponseStatus(logger logrus.FieldLogger, rw http.ResponseWriter) logrus.FieldLogger
- type LoggingMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger returns a context with a logrus logger embedded as a Value
func GetBaseLogger ¶
func GetBaseLogger() logrus.FieldLogger
DefaultLogger returns logging middleware base logger
func MethodNotAllowedLogger ¶
func MethodNotAllowedLogger() http.HandlerFunc
func NewLoggerFromContext ¶
func NewLoggerFromContext(ctx context.Context) logrus.FieldLogger
NewLoggerFromContext returns a logrus logger The logger is recovered from the given context or the StandardLogger
func NotFoundLogger ¶
func NotFoundLogger() http.HandlerFunc
func SetBaseLogger ¶
func SetBaseLogger(l logrus.FieldLogger)
func WithResponseStatus ¶
func WithResponseStatus(logger logrus.FieldLogger, rw http.ResponseWriter) logrus.FieldLogger
WithRequestStatus returns a new logger with fields: returned HTTP Status and HTTP body size The fields are extracted from our custom responseWriter type
Types ¶
type LoggingMiddleware ¶
type LoggingMiddleware struct {
// contains filtered or unexported fields
}
LoggingMiddleware is a Gorilla Mux middleware that logs information using logrus
var Logger LoggingMiddleware
func (LoggingMiddleware) Middleware ¶
func (l LoggingMiddleware) Middleware(next http.Handler) http.Handler
Middleware implement Gorilla Mux middleware interface The function is called for every request It builds a customized logger for the request and pass it in the request context for use in the endpoint