log/cmd/simple/main.go
Martin Riedl ba2ba315d0
All checks were successful
Build / Checks (push) Successful in 33s
Build / Code Coverage (push) Successful in 43s
Build / Build (push) Successful in 30s
Release / Semantic Release (push) Successful in 45s
docs: enhanced simple example
2025-03-04 20:56:50 +01:00

24 lines
371 B
Go

package main
import (
"runtime"
"git.martin-riedl.de/golang/log"
)
func main() {
someMethod()
anotherMethod()
}
func someMethod() {
log.Default.Info("Hello World")
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")
}