From 0c7ed0f06492890f25eaa80951ad135a72d7e75f Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Tue, 26 Dec 2023 00:54:08 +0100 Subject: [PATCH] doc: improve readme --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index d5e652b..003976f 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,22 @@ e.Use(slogecho.NewWithConfig(logger, config)) e.Use(middleware.Recover()) ``` +### Custom log levels + +```go +logger := slog.New(slog.NewTextHandler(os.Stdout, nil)) + +config := slogecho.Config{ + DefaultLevel: slog.LevelInfo, + ClientErrorLevel: slog.LevelWarn, + ServerErrorLevel: slog.LevelError, +} + +e := echo.New() +e.Use(slogecho.NewWithConfig(logger, config)) +e.Use(middleware.Recover()) +``` + ### Verbose ```go