@@ -31,7 +31,7 @@ such as gathering key-value pairs into `Attr`s, and then call one or more
3131and the output methods.
3232
3333An output method fulfills the main role of a logger: producing log output.
34- Here is an example call to an output method:
34+ Here is a call to an output method:
3535
3636 logger.Info("hello", "key", value)
3737
@@ -56,7 +56,6 @@ A logger's `With` method calls its handler's `WithAttrs` method.
5656
5757The ` WithGroup ` method is used to avoid avoid key collisions in large programs
5858by establishing separate namespaces.
59-
6059This call creates a new ` Logger ` value with a group named "g":
6160
6261 logger = logger.WithGroup("g")
@@ -102,8 +101,8 @@ and the `New` function that constructs it from an `io.Writer` and options:
102101
103102We'll support only one option, the ability to set a minimum level in order to
104103supress detailed log output.
105- Handlers should always use the ` slog.Leveler ` type for this option .
106- ` Leveler ` is implemented by both ` Level ` and ` LevelVar ` .
104+ Handlers should always declare this option to be a ` slog.Leveler ` .
105+ The ` slog. Leveler` interface is implemented by both ` Level ` and ` LevelVar ` .
107106A ` Level ` value is easy for the user to provide,
108107but changing the level of multiple handlers requires tracking them all.
109108If the user instead passes a ` LevelVar ` , then a single change to that ` LevelVar `
@@ -178,7 +177,7 @@ groups established by `WithGroup`.
178177
1791785 . Output the buffer.
180179
181- That is how our ` IndentHandler ` 's ` Handle ` method is structured:
180+ That is how ` IndentHandler. Handle ` is structured:
182181
183182%include indenthandler1/indent_handler.go handle -
184183
@@ -373,7 +372,7 @@ handler might look something like this:
373372 // ...
374373 }
375374
376- A single handleWidgets request might generate hundreds of log lines.
375+ A single ` handleWidgets ` request might generate hundreds of log lines.
377376For instance, it might contain code like this:
378377
379378 for _, w := range widgets {
@@ -460,7 +459,7 @@ for our example handler:
460459
461460%include indenthandler3/indent_handler_test.go TestSlogtest -
462461
463- Calling ` TestHandler ` is easy. The hard part is parsing the output.
462+ Calling ` TestHandler ` is easy. The hard part is parsing your handler's output.
464463` TestHandler ` calls your handler multiple times, resulting in a sequence of log
465464entries.
466465It is your job to parse each entry into a ` map[string]any ` .
@@ -569,8 +568,7 @@ like an invalid argument, is to panic or return an error.
569568The built-in handlers do not follow that advice.
570569Few things are more frustrating than being unable to debug a problem that
571570causes logging to fail;
572- our feeling is that it is
573- better to produce some output, however imperfect, than to produce none at all.
571+ it is better to produce some output, however imperfect, than to produce none at all.
574572That is why methods like ` Logger.Info ` convert programming bugs in their list of
575573key-value pairs, like missing values or malformed keys,
576574into ` Attr ` s that contain as much information as possible.
@@ -596,7 +594,7 @@ The most likely explanation for the issue is that a newer version of the `slog`
596594a new ` Kind ` &mdash ; a backwards-compatible change under the Go 1 Compatibility
597595Promise&mdash ; and the handler wasn't updated.
598596That is certainly a problem, but it shouldn't deprive
599- readers of the logs from seeing the rest of the output.
597+ readers from seeing the rest of the log output.
600598
601599There is one circumstance where returning an error from ` Handler.Handle ` is appropriate.
602600If the output operation itself fails, the best course of action is to report
0 commit comments