GithubHelp home page GithubHelp logo

krakend-gin-logger's Introduction

krakend-gin-logger's People

Contributors

ifaisalalam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dlutay fitraelbi

krakend-gin-logger's Issues

Add support for custom log formatter

Add support for custom Log Formatter which allows developers to print logs in a custom format and also allows adding more fields or removing fields in the log.

The custom Formatter function should have access to gin.LogFormatterParams, gin_logger.Config and logging.Logger instances.

make build doesnt work

I tried your logger and it doesn't work when im trying to bould krakend.
Im not a go coder, maybe im doing smth wrong.
Can u please checkout?
There's router_engine.go:

package krakend

import (
	"io"
	"github.com/ifaisalalam/krakend-gin-logger"
	botdetector "github.com/devopsfaith/krakend-botdetector/gin"
	httpsecure "github.com/devopsfaith/krakend-httpsecure/gin"
	lua "github.com/devopsfaith/krakend-lua/router/gin"
	"github.com/gin-gonic/gin"
	"github.com/luraproject/lura/config"
	"github.com/luraproject/lura/logging"
)

// NewEngine creates a new gin engine with some default values and a secure middleware
func NewEngine(cfg config.ServiceConfig, logger logging.Logger, w io.Writer) *gin.Engine {
	if !cfg.Debug {
		gin.SetMode(gin.ReleaseMode)
	}

	engine := gin.New()
    engine.Use(gin_logger.NewLogger(
	       cfg.ExtraConfig,
	       logger,
	       gin.LoggerConfig{Output: w}), gin.Recovery())

	engine.RedirectTrailingSlash = true
	engine.RedirectFixedPath = true
	engine.HandleMethodNotAllowed = true

	if err := httpsecure.Register(cfg.ExtraConfig, engine); err != nil {
		logger.Warning(err)
	}

	lua.Register(logger, cfg.ExtraConfig, engine)

	botdetector.Register(cfg, logger, engine)

	return engine
}

type engineFactory struct{}

func (e engineFactory) NewEngine(cfg config.ServiceConfig, l logging.Logger, w io.Writer) *gin.Engine {
	return NewEngine(cfg, l, w)
}

There's an error:

sakro@kali:/git/krakend-ce$ make build
Building the binary...
# github.com/devopsfaith/krakend-ce
./router_engine.go:22:12: cannot use cfg.ExtraConfig (type "github.com/luraproject/lura/config".ExtraConfig) as type "github.com/devopsfaith/krakend/config".ExtraConfig in argument to gin_logger.NewLogger
make: *** [Makefile:85: build] Error 2
sakro@kali:/git/krakend-ce$ 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.