add example script

This commit is contained in:
Jeffrey Paul 2024-06-14 05:39:08 -07:00
parent a852d938e7
commit ea0c84547f
1 changed files with 26 additions and 0 deletions

26
cmd/example/main.go Normal file
View File

@ -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"),
)
}