| > In fact, I tend to think more in terms of "events" when writing both logs and tracing code. They are events[1]. For my text editor, KeenWrite, events can be logged either to the console when run from the command-line or displayed in a dialog when running in GUI mode. By changing "logger.log()" statements to "event.publish()" statements, a number of practical benefits are realized, including: * Decoupled logging implementation from the system (swap one line of code to change loggers). * Publish events on a message bus (e.g., D-Bus) to allow extending system functionality without modifying the existing code base. * Standard logging format, which can be machine parsed, to help trace in-field production problems. * Ability to assign unique identifiers to each event, allowing for publication of problem/solution documentation based on those IDs (possibly even seeding LLMs these days). [1]: https://dave.autonoma.ca/blog/2022/01/08/logging-code-smell/ |