ectologger is a Go library that provides a standardized logging interface, allowing you to decouple your application code from specific logging implementations.
- Standardized logging interface
- Multiple log levels (Debug, Info, Warn, Error, Fatal)
- Context-aware logging
- Structured logging with fields
- Easy integration with existing loggers (e.g., zap)
- Customizable log output format
Add ectologger to your project:
go get -u github.com/Gobusters/ectologger-
Create a logger instance:
logger := ectologger.NewDefaultEctoLogger()
-
Use the logger in your code:
logger.Info("Starting the application") logger.WithField("request_id", "12345").Info("Handling request")
ectologger can be easily integrated with existing logging libraries like zap:
- Install zap:
go get -u go.uber.org/zap- Use the zap adapter:
import (
"github.com/Gobusters/ectologger/zapadapter"
"go.uber.org/zap"
)
zapLogger, _ := zap.NewProduction()
ectoLogger := zapadapter.NewZapEctoLogger(zapLogger, nil)ectologger is licensed under the MIT License. See the LICENSE file for more details.