docs: enhanced simple example
This commit is contained in:
parent
a1c991bcbd
commit
ba2ba315d0
2 changed files with 13 additions and 2 deletions
|
@ -12,6 +12,8 @@ func main(){
|
|||
}
|
||||
```
|
||||
|
||||
Check out this [simple example file](cmd/simple/main.go) for the basic usage.
|
||||
|
||||
## Multiple Log Instance
|
||||
|
||||
Create a new log instance (instead of using the `Default`).
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"git.martin-riedl.de/golang/log"
|
||||
"runtime"
|
||||
|
||||
"git.martin-riedl.de/golang/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
someMethod()
|
||||
anotherMethod()
|
||||
}
|
||||
|
||||
func someMethod() {
|
||||
log.Default.Info("Hello World")
|
||||
log.Default.With("os", runtime.GOOS).Info("environment detected")
|
||||
log.Default.With("os", runtime.GOOS).Warning("environment detected")
|
||||
}
|
||||
|
||||
func anotherMethod() {
|
||||
log.Default.WithMap(map[string]any{
|
||||
"foo": "bar",
|
||||
"bar": "baz",
|
||||
}).Info("Second Hello World")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue