add example script
This commit is contained in:
parent
a852d938e7
commit
ea0c84547f
|
@ -0,0 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
_ "sneak.berlin/go/simplelog"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
// log structured data with slog as usual:
|
||||
slog.Info(
|
||||
"User login attempt",
|
||||
slog.String("user", "JohnDoe"),
|
||||
slog.Int("attempt", 3),
|
||||
)
|
||||
slog.Warn(
|
||||
"Configuration mismatch",
|
||||
slog.String("expected", "config.json"),
|
||||
slog.String("found", "config.dev.json"),
|
||||
)
|
||||
slog.Error(
|
||||
"Failed to save data",
|
||||
slog.String("reason", "permission denied"),
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue