[AD] Turning logging on in release builds by default |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: [AD] Turning logging on in release builds by default
- From: SiegeLord <siegelordex@xxxxxxxxxx>
- Date: Sun, 07 Jun 2015 11:21:44 -0700
I spent a little bit of time implementing things to enable logging by
default in Allegro release builds. By 'logging by default' I mean that
the logging calls are not compiled out, but nothing is actually logged
as the release builds default to filtering out all the logging messages.
This amounts to two branches and a single function call per logging
statement.
Thus, from the point of view of the users, nothing changes (e.g. there's
no allegro.log popping out everywhere). However, by placing an
allegro5.cfg next to the program, you can enable logging without
recompiling. This seems like a useful feature to have since quite a few
of our distribution methods don't compile the debug build, and to access
the debug binaries you need to compile them yourself.
Since adding that allegro5.cfg is a bit of a pain at times, I also made
it so that you can set the logging level in the system configuration
before al_install_system. I.e. in your program you can call
al_set_config_value(al_get_system_config(), "trace", "level", "debug");
before al_install_system and enable debugging that way. This required
changing how the system configuration worked a little bit.
I checked the performance of this, and saw no detectable changes (I
tested primarily with ex_blit, as that logs about 6-10 times per frame)
so I don't think that's a concern. You can always compile Allegro
yourself to disable the logging statements (the final piece of this work
was simply flipping WANT_RELEASE_LOGGING from 'off' to 'on' in
CMakeLists.txt) if you're worried about your end users somehow screwing
something up with this logging.
So what do you all think? Any objections to merging this? The
implementation is here:
https://github.com/liballeg/allegro5/pull/14/commits
-SL