Categorygithub.com/surfe/logger/v2
package
2.0.1
Repository: https://github.com/surfe/logger.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Logger

Logging library wrapper with Echo.

Install

go get -u github.com/surfe/logger

Usage

Initialization

Initiate a Zap logger;

zapLogger, err := zap.Init()
if err != nil {
	log.Panic(err)
}
defer zapLogger.Sync()

Use the logger;

l := logger.Use(zapLogger)

Logging

Error with a message and extra fields;

import "github.com/surfe/logger"

...

fields := []any{l.UserKey, "[email protected]"}
logger.Log(ctx).Err(err).With(fields...).Error("Add Contact (SF)")

Echo Middleware

e.Use(l.EchoMiddleware())

Development

You can use go work to develop this module:

go work init .
go work use ../logger