This commit introduces the StructuredLogger module, which provides a
robust and flexible logging utility supporting multiple data formats
(CSV, JSON, and YAML). By incorporating this module into our CI system,
we enhance our log management capabilities, making it easier to:
1. Monitor and analyze logs: The StructuredLogger is a dict-like data
abstraction which autosaves into a structured data file, whenever it
is updated. With this file, one can easily know specifics of the job
execution without having to grep it in the traces logs or exploring
the job artifacts. The autosave feature makes it useful even when the
CI job fails unexpectedly, since the partial dict is always written
back to the disk.
2. Maintain data integrity: The module includes context managers for
file locking and editing log data, ensuring data integrity and
preventing race conditions.
3. Support multiple formats: With built-in support for CSV, JSON, and
YAML formats, this module caters to a wide range of use cases and
user preferences.
4. Increase maintainability: The modular design of the StructuredLogger
and its corresponding strategies simplifies maintenance and allows
for seamless integration of additional formats in the future.
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22500>