Libs/event_logging: add the ability to prefix events names with sections
What
This MR introduces an optional ?prefix_name_with_section:bool parameter to the event declaration functions (e.g., declare_0, declare_1, etc.) in the event logging library. When enabled, it prefixes the event’s name with its section (if provided) using underscores as delimiters. This modification is implemented in a backward-compatible way by defaulting the flag to false.
Why
Event names are expected to be unique, as highlighted in !17103 (diffs), which is especially crucial for Tezt tests that rely on waiting for specific events. Prefixing the event name with its section reduces the probability of duplicate names and helps maintain the intended uniqueness (we noticed that sections are usually added manually in events, at least for DAL).
How
- PEach event declaration function now accepts an optional
?prefix_name_with_sectionparameter. - A helper function
may_prefix_namechecks the flag and, if enabled along with a given section list, concatenates it and the event name with underscores. - The default value of
prefix_name_with_sectionis set tofalse, ensuring existing code remains unaffected.
This implementation enhances event logging flexibility while preserving the existing behavior when the flag is not explicitly enabled.