| 1 | # logr |
| 2 | Go logging library with levels. |
| 3 | |
| 4 | ## Usage |
| 5 | ```console |
| 6 | go get -u github.com/TwiN/logr |
| 7 | ``` |
| 8 | |
| 9 | ```go |
| 10 | import "github.com/TwiN/logr" |
| 11 | |
| 12 | func main() { |
| 13 | logr.Debug("This is a debug message") |
| 14 | logr.Infof("This is an %s message", "info") |
| 15 | logr.Warn("This is a warn message") |
| 16 | logr.Error("This is an error message") |
| 17 | logr.Fatal("This is a fatal message") // Exits with code 1 |
| 18 | } |
| 19 | ``` |
| 20 | |
| 21 | You can set the default logger's threshold like so: |
| 22 | ```go |
| 23 | logr.SetThreshold(logr.LevelWarn) |
| 24 | ``` |
| 25 | The above would make it so only `WARN`, `ERROR` and `FATAL` messages are logged, while `DEBUG` and `INFO` messages are ignored. |
| 26 | |
| 27 | TODO: Finish documentation |