Better README
This commit is contained in:
parent
75cf71e917
commit
62e3eac0a9
13
README.md
13
README.md
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
`go get -u https://gitea.larvit.se/pwrpln/go_log`
|
`go get -u gitea.larvit.se/pwrpln/go_log`
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
|
@ -57,13 +57,20 @@ log.Info("Zep", "other", "stuff")
|
||||||
All available options, and their defaults:
|
All available options, and their defaults:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
loc, _ := time.LoadLocation("UTC")
|
loc, _ := time.LoadLocation("UTC") // See more info at https://pkg.go.dev/time#LoadLocation
|
||||||
log := go_log.Log{
|
log := go_log.Log{
|
||||||
Context: []interface{}, // Will be prepended to metadata on all log entries
|
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
|
Fmt: go_log.DefaultFmt, // Log message formatter
|
||||||
Stderr: go_log.DefaultStderr, // Log message outputter for Debug, Verbose and Info
|
Stderr: go_log.DefaultStderr, // Log message outputter for Debug, Verbose and Info
|
||||||
Stdout: go_log.DefaultStdout, // Log message outputter for Warning and Error
|
Stdout: go_log.DefaultStdout, // Log message outputter for Warning and Error
|
||||||
TimeLocation: loc, // Timestamp location/time zone setting
|
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")
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user