https://github.com/zcubbs/log
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.
https://github.com/zcubbs/log
Last synced: about 1 month ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/zcubbs/log
- Owner: zcubbs
- License: mit
- Created: 2023-10-15T15:34:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-14T20:41:29.000Z (over 2 years ago)
- Last Synced: 2025-03-11T11:48:29.795Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Log
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.
[](https://github.com/zcubbs/logwrapper/releases)

[](https://pkg.go.dev/github.com/zcubbs/logwrapper)
[](https://github.com/zcubbs/logwrapper/actions/workflows/lint.yaml)
[](https://github.com/zcubbs/logwrapper/actions/workflows/scan.yaml)

[](https://goreportcard.com/report/github.com/zcubbs/logwrapper)
[](https://github.com/zcubbs/logwrapper/graphs/contributors)
[](./LICENSE)
## Installation
To install the LogWrapper package, run the following command:
```bash
go get github.com/zcubbs/log
```
## Usage
Here is a simple example demonstrating the usage of LogWrapper with different logging types and formats:
```go
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`](./examples/example.go) in this repository.
## Supported Loggers
- [Logrus](https://github.com/sirupsen/logrus)
- [Zap](https://github.com/uber-go/zap)
- [Charmlog](https://github.com/charmbracelet/log)
- Standard log package
## Supported Formats
- JSON
- Text (Human-Readable)
## Contributing
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.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.