Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dollarsignteam/go-logger
Logger for Golang
https://github.com/dollarsignteam/go-logger
Last synced: about 2 months ago
JSON representation
Logger for Golang
- Host: GitHub
- URL: https://github.com/dollarsignteam/go-logger
- Owner: dollarsignteam
- License: mit
- Created: 2022-02-03T07:10:15.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-07T07:29:49.000Z (almost 2 years ago)
- Last Synced: 2024-11-06T09:17:16.245Z (2 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Logger for Golang
It is based on the [zap][1] package.
## Install
```shell
go get github.com/dollarsignteam/go-logger
```## Usage
```go
package mainimport (
"github.com/dollarsignteam/go-logger"
)func main() {
opts := logger.LoggerOptions{
Level: "debug",
Name: "DEMO",
HideCaller: false,
}
log := logger.NewLogger(opts)
log.Debug("I am a debug log")
log.Info("I am a info log")
log.Warn("I am a warn log")
log.Error("I am a error log")
}
```Output
```shell
2022-02-03 22:49:44.933 +07:00 [go] 🟪 DEBUG [DEMO] [main.go:14 main.main] I am a debug log
2022-02-03 22:49:44.934 +07:00 [go] ⬜️ INFO [DEMO] [main.go:15 main.main] I am a info log
2022-02-03 22:49:44.934 +07:00 [go] 🟧 WARN [DEMO] [main.go:16 main.main] I am a warn log
2022-02-03 22:49:44.934 +07:00 [go] 🟥 ERROR [DEMO] [main.go:17 main.main] I am a error log
```## Author
Dollarsign
## License
Licensed under the MIT License - see the [LICENSE][2] file for details.
[1]: https://github.com/uber-go/zap
[2]: https://github.com/dollarsignteam/go-logger/blob/main/LICENSE