A versatile Go logging wrapper that allows seamless integration and toggling between various logging libraries such as Logrus, Zap, Charmlog and the standard log package. It also supports different logging formats like JSON and text, making it a flexible choice for various application needs.
To install the LogWrapper package, run the following command:
go get github.com/zcubbs/log
Here is a simple example demonstrating the usage of LogWrapper with different logging types and formats:
package main
import (
"github.com/zcubbs/log"
"github.com/zcubbs/log/structuredlogger"
)
func main() {
log.Info("This is an info message in JSON format")
log.SetFormat(structuredlogger.TextFormat)
log.Info("This is an info message in text format")
}
For a more comprehensive example, please refer to example.go
in this repository.
- JSON
- Text (Human-Readable)
We welcome contributions from the community! Feel free to open issues for bug reports or feature requests, and submit pull requests for improvements to the codebase.
This project is licensed under the MIT License - see the LICENSE file for details.