Skip to content

Commit

Permalink
Add ALLEGRO_TRACE_LEVEL environment variable.
Browse files Browse the repository at this point in the history
Fixes #1556
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Jun 14, 2024
1 parent 36f9609 commit b5c4b1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions allegro5.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ webp_quality_level = lossless
# device0=/dev/input/by-id/usb-blahblah-joystick

# Windows: You can choose between the XINPUT or DIRECTINPUT driver for
# joysticks and force feedback joysticks. Xinput is the more modern
# system, but DirectInput has more force feedback capabilities for older
# joysticks and force feedback joysticks. Xinput is the more modern
# system, but DirectInput has more force feedback capabilities for older
# joysticks.
driver=XINPUT

Expand Down Expand Up @@ -189,6 +189,7 @@ channels=all
# If not none, Allegro will write out the logs to an allegro.log file next to
# the binary. Use ALLEGRO_TRACE environment variable to control that file
# location. A special filename of - (dash) means logging to stdout.
# You can override this value via the ALLEGRO_TRACE_LEVEL environment variable.
level=

# Set to 0 to disable line numbers in log files.
Expand Down
4 changes: 3 additions & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ void _al_configure_logging(void)
trace_info.level = 9999;
#endif

v = al_get_config_value(config, "trace", "level");
v = getenv("ALLEGRO_TRACE_LEVEL");
if (!v)
v = al_get_config_value(config, "trace", "level");
if (v) {
if (!strcmp(v, "error")) trace_info.level = 3;
else if (!strcmp(v, "warn")) trace_info.level = 2;
Expand Down

0 comments on commit b5c4b1e

Please sign in to comment.