commit | a68e582fa157abff310e2a9a287b21a1fe1e1629 | [log] [tgz] |
---|---|---|
author | Seth Vargo <seth@sethvargo.com> | Tue Jan 17 13:38:31 2023 -0500 |
committer | Jonathan Amsterdam <jba@google.com> | Wed Jan 18 13:47:22 2023 +0000 |
tree | 9a87d1cebf0b4a4a4f8b3bdeda156412901b134e | |
parent | 1de6713980dea447778ef6e71194d5eb54288072 [diff] |
exp/slog: add example for custom levels and names The recommended way to introduce new `Level` (or rename an existing one) is via `HandlerOptions.ReplaceAttr`. However, this is not immediately intuitive to package users. This introduces an example that adds additional log levels and gives them custom names in a `ReplaceAttr` function. Given the number of users who will want to introduce custom log levels, this feels like a good addition to the library documentation. Change-Id: I175440368fa1d4ce548d9c769ca22fd613151941 Reviewed-on: https://go-review.googlesource.com/c/exp/+/462435 Reviewed-by: Jonathan Amsterdam <jba@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This subrepository holds experimental and deprecated (in the old
directory) packages.
The idea for this subrepository originated as the pkg/exp
directory of the main repository, but its presence there made it unavailable to users of the binary downloads of the Go installation. The subrepository has therefore been created to make it possible to go get
these packages.
Warning: Packages here are experimental and unreliable. Some may one day be promoted to the main repository or other subrepository, or they may be modified arbitrarily or even disappear altogether.
In short, code in this subrepository is not subject to the Go 1 compatibility promise. (No subrepo is, but the promise is even more likely to be violated by go.exp than the others.)
Caveat emptor.