Skip to content

zap logger for fasthttp

Compare
Choose a tag to compare
@misnaged misnaged released this 12 Feb 22:47
· 24 commits to main since this release

FastHttp logging using zap logger!

To add fasthttp logger into your project you would be needed to follow these simple stepps:

  • add logger initialization inside your main.go func
//main.go:
package main

import("github.com/gateway-fm/scriptorium/logger")


func main(){

              //   note: default logger mode is "prod"
              //   If you're looking for more readable one: 
              //  "export ENV=local"

 logger.SetLoggerMode(os.Getenv("ENV")) 

}
  • use it while ctx *fasthttp.RequestCtx is available
//your_fasthttp_func.go:
func Foo(ctx *fasthttp.RequestCtx) {
	logger.LogFast(ctx).Info("hello world")
	logger.LogFast(ctx).With()
       // etc...