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: 0

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