middleware

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2018 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

echo-logrus

Build Status Go Report Card License

Overview

Middleware echo-logrus is a logrus logger support for Echo.
This middleware is working on echo v3.

Getting Started

For dep users

When your project top dir run this.

$ dep ensure -add github.com/neko-neko/echo-logrus
Other users

Run this.

$ go get github.com/neko-neko/echo-logrus

Example

package main

import (
	"os"
	"time"

	"github.com/Sirupsen/logrus"
	"github.com/labstack/echo"
	echoLog "github.com/labstack/gommon/log"
	"github.com/neko-neko/echo-logrus"
	"github.com/neko-neko/echo-logrus/log"
)

func main() {
	e := echo.New()

	// Logger
	log.Logger().SetOutput(os.Stdout)
	log.Logger().SetLevel(echoLog.INFO)
	log.Logger().SetFormatter(&logrus.JSONFormatter{
		TimestampFormat: time.RFC3339,
	})
	e.Logger = log.Logger()
	e.Use(middleware.Logger())
	log.Info("Logger enabled!!")

	e.Logger.Fatal(e.Start(":1323"))
}

Documentation

Overview

Package middleware provides echo request and response output log

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger() echo.MiddlewareFunc

Logger returns a middleware that logs HTTP requests.

Types

This section is empty.

Directories

Path Synopsis
Package log wrapped logrus functions
Package log wrapped logrus functions

Jump to

Keyboard shortcuts

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