bu/gin-method-override

Hide first request in logging

bu opened this issue · 2 comments

bu commented

What is happening now?

Currently, this middleware will print two different records for single re-dispatch request.

What should be done to solve or improve this?

  1. Developer should be able to decide should the first request appear.
  2. And can decide should it marked with (REDISPATCHED)

Credits

Thanks for Tommy reporting this issue, related to #1

TJM commented

This is actually resolved by the notes at the bottom of #1

Do not use gin.Default() as it logs before any other processing is handled.

	router := gin.New()

	// Handle methodOverride
	router.Use(method.ProcessMethodOverride(router))

	// The rest of the default handlers
	router.Use(gin.Logger())
	router.Use(gin.Recovery())
bu commented

Close this issue, thanks to @TJM 's solution