Skip to content

Commit b6e8b86

Browse files
committed
docs(error_test.go): add comments to clarify the behavior of the LogValue method in the ExampleError_LogValue function
1 parent 5556c65 commit b6e8b86

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

error_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,8 @@ func ExampleError_LogValue() {
915915
)
916916

917917
// The error implements slog.LogValuer interface automatically
918+
// When err is passed to a slog logger (e.g. via slog.Any("error", err)), its LogValue() method is called automatically.
919+
// We can inspect the returned slog.Value for demonstration.
918920
logValue := err.LogValue()
919921

920922
// Extract some information from the log value for demonstration

0 commit comments

Comments
 (0)