File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,12 @@ If the user instead passes a `LevelVar`, then a single change to that `LevelVar`
147147will change the behavior of all handlers that contain it.
148148Changes to ` LevelVar ` s are goroutine-safe.
149149
150+ You might also consider adding a ` ReplaceAttr ` option to your handler,
151+ like the [ one for the built-in
152+ handlers] ( https://pkg.go.dev/log/slog#HandlerOptions.ReplaceAttr ) .
153+ Although ` ReplaceAttr ` will complicate your implementation, it will also
154+ make your handler more generally useful.
155+
150156The mutex will be used to ensure that writes to the ` io.Writer ` happen atomically.
151157Unusually, ` IndentHandler ` holds a pointer to a ` sync.Mutex ` rather than holding a
152158` sync.Mutex ` directly.
@@ -504,7 +510,9 @@ number of calls to those methods, because of the repeated copying.
504510That is unlikely to matter in practice, but if it bothers you,
505511you can use a linked list instead,
506512which ` Handle ` will have to reverse or visit recursively.
507- See [ github.com/jba/slog/withsupport] ( https://github.com/jba/slog/withsupport ) for an implementation.
513+ See the
514+ [ github.com/jba/slog/withsupport] ( https://github.com/jba/slog/tree/main/withsupport )
515+ package for an implementation.
508516
509517#### Getting the mutex right
510518
Original file line number Diff line number Diff line change @@ -109,6 +109,12 @@ If the user instead passes a `LevelVar`, then a single change to that `LevelVar`
109109will change the behavior of all handlers that contain it.
110110Changes to ` LevelVar ` s are goroutine-safe.
111111
112+ You might also consider adding a ` ReplaceAttr ` option to your handler,
113+ like the [ one for the built-in
114+ handlers] ( https://pkg.go.dev/log/slog#HandlerOptions.ReplaceAttr ) .
115+ Although ` ReplaceAttr ` will complicate your implementation, it will also
116+ make your handler more generally useful.
117+
112118The mutex will be used to ensure that writes to the ` io.Writer ` happen atomically.
113119Unusually, ` IndentHandler ` holds a pointer to a ` sync.Mutex ` rather than holding a
114120` sync.Mutex ` directly.
@@ -323,7 +329,9 @@ number of calls to those methods, because of the repeated copying.
323329That is unlikely to matter in practice, but if it bothers you,
324330you can use a linked list instead,
325331which ` Handle ` will have to reverse or visit recursively.
326- See [ github.com/jba/slog/withsupport] ( https://github.com/jba/slog/withsupport ) for an implementation.
332+ See the
333+ [ github.com/jba/slog/withsupport] ( https://github.com/jba/slog/tree/main/withsupport )
334+ package for an implementation.
327335
328336#### Getting the mutex right
329337
You can’t perform that action at this time.
0 commit comments