Custom Logger 🚧
Log is an important part of any application. In Remilia, we utilize zap (opens in a new tab) to provide a fast, structured, leveled logging. However, you can replace the default logger with your own logger.
🍰️
In most cases, a custom logging configuration is probably a better choice.
You can provide your logger by using the WithLogger
option. The logger must implement the remilia.Logger
interface.
rem, _ := remilia.New(
remilia.WithLogger(&MyLogger{}),
)
Logger Interface
The remilia.Logger
interface is a simple interface that has three methods: Debug
, Info
, Warn
, Error
and Panic
.
type logContext map[string]interface{}
type Logger interface {
Debug(msg string, context ...logContext)
Info(msg string, context ...logContext)
Warn(msg string, context ...logContext)
Error(msg string, context ...logContext)
Panic(msg string, context ...logContext)
}