From 85d52ab31b7c3d233e88eb6e77f4f4efa5f40e69 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 31 Oct 2023 19:53:31 -0400 Subject: [PATCH] doc: add slog support --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index a43ac7b..b7bc331 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ readable logging with batteries included. - Leveled logging. - Text, JSON, and Logfmt formatters. - Store and retrieve logger in and from context. +- Slog handler. - Standard log adapter. ## Usage @@ -306,6 +307,17 @@ startOven(400) // INFO Starting oven degree=400 This will use the _caller_ function (`startOven`) line number instead of the logging function (`log.Info`) to report the source location. +### Slog Handler + +You can use Log as an [`log/slog`](https://pkg.go.dev/log/slog) handler. Just +pass a logger instance to Slog and you're good to go. + +```go +handler := log.New(os.Stderr) +logger := slog.New(handler) +logger.Error("meow?") +``` + ### Standard Log Adapter Some Go libraries, especially the ones in the standard library, will only accept