Hi,
Now I am using a lot on gin. And now I wonder if I can disable gin's stdout ?
If there is some , then how?
Thanks.
Just initialize gin with New instead of Default. I assume you're talking about the Logger middleware.
gin.New()
r.Use(gin.Recovery())
Yes, I do not hope to use Stdout but Logger middleware instead. Thank you very much.
Well the Logger is always going to write to stdout. Unless you redirect the output to a file, or use something like supervisord. If you want to write to a specific file without redirection you'd have to write your own Logger middleware.
@allencloud this might be the droid you are looking for:
gin.SetMode(gin.ReleaseMode)
Took me weeks before i found it :)
Thanks a lot @nazwa . It works perfectly. :)
$ export GIN_MODE=release
@allencloud
Try this:
gin.SetMode(gin.ReleaseMode)
gin.DefaultWriter = ioutil.Discard
@allencloud
Try this:
gin.SetMode(gin.ReleaseMode) gin.DefaultWriter = ioutil.Discard
Works perfectly!!!!! thanks
// init gin.Engine like this
engine = gin.Default()
engine.RouterGroup.Handlers = engine.RouterGroup.Handlers[0:0]
engine.Use(gin.Recovery())
// init gin.Engine like this
engine = gin.Default()
engine.RouterGroup.Handlers = engine.RouterGroup.Handlers[0:0]
engine.Use(gin.Recovery())
Most helpful comment
@allencloud
Try this: