https://github.com/kevinburke/slogdefault
Make log/slog's default Handler customizable
https://github.com/kevinburke/slogdefault
go logging
Last synced: over 1 year ago
JSON representation
Make log/slog's default Handler customizable
- Host: GitHub
- URL: https://github.com/kevinburke/slogdefault
- Owner: kevinburke
- Created: 2024-03-28T19:50:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-28T23:23:00.000Z (over 2 years ago)
- Last Synced: 2024-05-01T23:57:52.348Z (about 2 years ago)
- Topics: go, logging
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# slogdefault
This is a trivial library that exposes the standard library's
`log/slog.Default()` and makes it customizable.
### Usage
```go
h := slogdefault.NewHandler(output, &slog.HandlerOptions{/* ... */}
logger := slog.New(h)
logger.Info("test message")
```
Use this to add source lines, change the log level, chain handlers, etc.