logger

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context, entry logrus.FieldLogger) context.Context

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

Jump to

Keyboard shortcuts

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