File: README.md

package info (click to toggle)
golang-github-twin-logr 0.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 92 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# logr
Go logging library with levels.

## Usage
```console
go get -u github.com/TwiN/logr
```

```go
import "github.com/TwiN/logr"

func main() {
    logr.Debug("This is a debug message")
    logr.Infof("This is an %s message", "info")
    logr.Warn("This is a warn message")
    logr.Error("This is an error message")
    logr.Fatal("This is a fatal message") // Exits with code 1
}
```

You can set the default logger's threshold like so:
```go
logr.SetThreshold(logr.LevelWarn)
```
The above would make it so only `WARN`, `ERROR` and `FATAL` messages are logged, while `DEBUG` and `INFO` messages are ignored.

TODO: Finish documentation