Re:Logging as a code smell
by kazinator on Tuesday January 11, 2022 @01:39AM
(#29888337)
The author is severely confused. What he's calling logs are actually debug traces. You don't want to use events for those.
> eases the transition to internationalized log messages
You don't internationalize debug traces any more than you internationalize your function names or programming language words. You barely even fix spelling mistakes in trace messages. Often, you build software without them at all: "compile them out".
One excellent reason not to use events for trace messages is that you may sometimes want every last trace message leading up to a crash to be recorded, which won't happen if they go through an event system where they sit in a queue which is no longer being serviced since everything died.
Oh, and your shiny event system could have issues, debugging which could benefit from trace messages.
> eases the transition to internationalized log messages
You don't internationalize debug traces any more than you internationalize your function names or programming language words. You barely even fix spelling mistakes in trace messages. Often, you build software without them at all: "compile them out".
One excellent reason not to use events for trace messages is that you may sometimes want every last trace message leading up to a crash to be recorded, which won't happen if they go through an event system where they sit in a queue which is no longer being serviced since everything died.
Oh, and your shiny event system could have issues, debugging which could benefit from trace messages.