2 Commits

Author SHA1 Message Date
db30b03f8f Fixed errors in the documentation 2023-02-20 23:15:08 +01:00
62e3eac0a9 Better README 2023-02-20 22:23:10 +01:00

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,21 @@ 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
Context: []interface{}{}, // Will be prepended to metadata on all log entries
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")
log.Context = []interface{}{"key1", "value1", "key2", "value2"}
```