https://github.com/tim-koehler/tims-logger
Simple and easy to use custom logger with json support
https://github.com/tim-koehler/tims-logger
color-logger go golang json-logger logger
Last synced: 4 months ago
JSON representation
Simple and easy to use custom logger with json support
- Host: GitHub
- URL: https://github.com/tim-koehler/tims-logger
- Owner: tim-koehler
- Created: 2020-11-03T23:56:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-26T21:10:18.000Z (almost 3 years ago)
- Last Synced: 2025-01-17T14:36:12.782Z (5 months ago)
- Topics: color-logger, go, golang, json-logger, logger
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TimsLogger [](https://github.com/tim-koehler/tims-logger/actions/workflows/go.yml) [](https://coveralls.io/github/tim-koehler/tims-logger) [](https://goreportcard.com/report/github.com/tim-koehler/tims-logger)
A logger build for my personal needs. Maybe you will also enjoy it :)
## Install
```bash
go get -u github.com/tim-koehler/tims-logger
```## Example
```go
package mainimport logger "github.com/tim-koehler/tims-logger"
func main() {
logger.SetColoredLogs(true)
logger.SetLogLevel(logger.DEBUG.String())// TEXT Logging
logger.SetLogType(logger.TEXT.String()) // logger.SetLogType("TEXT")
logger.Debugln("Debug log")
logger.Infoln("Info log")
logger.Warningln("Warning log")
logger.Errorln("Error log")// JSON Logging
logger.SetLogType(logger.JSON.String()) // logger.SetLogType("JSON")
logger.Debugln("Some error")
logger.Infoln(logger.Custom{
"foo": "bar",
"baz": 123,
})
}
```