Better README

This commit is contained in:
Lilleman auf Larv 2023-02-20 22:23:10 +01:00
parent 75cf71e917
commit 62e3eac0a9

View File

@ -2,7 +2,7 @@
## Installation
`go get -u https://gitea.larvit.se/pwrpln/go_log`
`go get -u gitea.larvit.se/pwrpln/go_log`
## Example usage
@ -57,13 +57,20 @@ log.Info("Zep", "other", "stuff")
All available options, and their defaults:
```go
loc, _ := time.LoadLocation("UTC")
loc, _ := time.LoadLocation("UTC") // See more info at https://pkg.go.dev/time#LoadLocation
log := go_log.Log{
Context: []interface{}, // Will be prepended to metadata on all log entries
MinLogLvl: go_log.Info, // Minimal log level to output
MinLogLvl: go_log.LogLvlFromStr("Info"), // Minimal log level to output
Fmt: go_log.DefaultFmt, // Log message formatter
Stderr: go_log.DefaultStderr, // Log message outputter for Debug, Verbose and Info
Stdout: go_log.DefaultStdout, // Log message outputter for Warning and Error
TimeLocation: loc, // Timestamp location/time zone setting
}
```
Or change them after initialization like this:
```go
log := go_log.GetLog()
log.MinLogLvl = go_log.LogLvlFromStr("Debug")
```