util/log: Add MESA_LOG_PREFIX environment variable to control log prefixes

Add a new MESA_LOG_PREFIX environment variable that allows fine-grained
control over log prefixes in file logger output on Linux. The variable
accepts a comma-separated list of options:
- "tag": include the tag prefix (e.g., "MESA:")
- "level": include the level prefix (e.g., "info:")

By default, both tag and level are included. Users can customize the
prefix by setting MESA_LOG_PREFIX to any combination (e.g., "tag",
"level", "tag,level", or empty string for no prefix), making the output
more flexible and readable for different use cases.

Other loggers (syslog, Android logcat, Windows debugger) are unaffected
and continue to include tag and level information as appropriate for
their format.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38217>
This commit is contained in:
Christian Gmeiner
2025-11-05 20:56:14 +01:00
committed by Marge Bot
parent 672c26535a
commit c346f2b673
2 changed files with 22 additions and 8 deletions
+4
View File
@@ -98,6 +98,10 @@ Core Mesa environment variables
specifies a file name for logging all errors, warnings, etc., rather
than stderr
.. envvar:: MESA_LOG_PREFIX
specifies what to to include in the log prefix (linux only) - default is ``tag,level``
.. envvar:: MESA_EXTENSION_OVERRIDE
can be used to enable/disable extensions. A value such as