Logging library wrapper with Echo
.
go get -u github.com/surfe/logger
Initiate a Zap logger;
zapLogger, err := zap.Init()
if err != nil {
log.Panic(err)
}
defer zapLogger.Sync()
Use the logger;
l := logger.Use(zapLogger)
Error with a message and extra fields;
import "github.com/surfe/logger"
...
fields := []any{l.UserKey, "abc@xyz.com"}
logger.Log(ctx).Err(err).With(fields...).Error("Add Contact (SF)")
e.Use(l.EchoMiddleware())
You can use go work
to develop this module:
go work init .
go work use ../logger