https://github.com/ulbora/level_logger
A logger with error, debug, and info levels. This logger can be set to a new log level by passing in an external variable.
https://github.com/ulbora/level_logger
Last synced: about 1 month ago
JSON representation
A logger with error, debug, and info levels. This logger can be set to a new log level by passing in an external variable.
- Host: GitHub
- URL: https://github.com/ulbora/level_logger
- Owner: Ulbora
- License: mit
- Created: 2020-02-01T17:42:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-02T23:12:33.000Z (about 5 years ago)
- Last Synced: 2025-01-26T13:22:02.077Z (3 months ago)
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/Ulbora/Level_Logger)
[](https://godoc.org/github.com/Ulbora/Level_Logger)Level Logger
============A three level logger for Golang. It has the following levels: debug, info, and error.
The logging level can be set by setting the LogLevel varible as shown:
### Error
Error logging is alwas on and cannot be turned off.```
var l Logger
i, e := strconv.Atoi("1q")
l.Error(e)```
#### Output
```
2020/02/02 15:57:51 ERROR: strconv.Atoi: parsing "1q": invalid syntax```
### Info
```
var l Logger
l.LogLevel = InfoLevel
i, e := strconv.Atoi("1q")
l.Info(e)```
#### Output
```
2020/02/02 15:57:51 INFO: strconv.Atoi: parsing "1q": invalid syntax```
### Debug
```
var l Logger
l.LogLevel = DebugLevel
i, e := strconv.Atoi("1q")
l.Debug(e)
```#### Output
```
2020/02/02 15:57:51 DEBUG: strconv.Atoi: parsing "1q": invalid syntax```
### Log All
```
var l Logger
l.LogLevel = AllLevel
i, e := strconv.Atoi("1q")
l.Info(e)
```#### Output
```
2020/02/02 15:57:51 INFO: strconv.Atoi: parsing "1q": invalid syntax```
### Logging Off
```
var l Logger
l.LogLevel = OffLevel
i, e := strconv.Atoi("1q")
l.Info(e)
```#### Output
```
No logs are shown```