Skip to content

Commit

Permalink
docs: explain relationship between Logger{} and Discard()
Browse files Browse the repository at this point in the history
The zero logger used to crash, but that was fixed recently.
  • Loading branch information
pohly authored and thockin committed Apr 24, 2023
1 parent 5d57712 commit 6134c6a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions logr.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ limitations under the License.
// such a value can call its methods without having to check whether the
// instance is ready for use.
//
// Calling methods with the null logger (Logger{}) as instance will crash
// because it has no LogSink. Therefore this null logger should never be passed
// around. For cases where passing a logger is optional, a pointer to Logger
// The zero logger (= Logger{}) is identical to Discard() and discards all log
// entries. Code that receives a Logger by value can simply call it, the methods
// will never crash. For cases where passing a logger is optional, a pointer to Logger
// should be used.
//
// # Key Naming Conventions
Expand Down

0 comments on commit 6134c6a

Please sign in to comment.