Better control/API over runtime logging from zlib?
zlib has the ability to log runtime log messages. These log messages are only logged if a compile/build time flag is enabled ZLIB_DEBUG. This then means that it all depends on who/how the library is built for logging to be available at runtime.
Recently, we have been trying to solve an issue in zlib that's shipped in macos aarch64 systems. The zlib shipped in that system wasn't built with ZLIB_DEBUG enabled (we verified it by calling zlibCompileFlags() at runtime and checking its output as noted in https://github.com/madler/zlib/blob/master/zlib.h#L1185). This effectively means that to be able to investigate the issue we need to rebuild that library with ZLIB_DEBUG, which isn't feasible given the lack of access to the actual source and the actual build command/configurations that were used to build it originally.
Would it be feasible to introduce a way where this crucial logging can be enabled at runtime without having to rebuild the library? Perhaps an explicit API on the zlib library which enables the logging or maybe some runtime environment variable which enables it? I don't know if there's a precedent to allow environment variables to enable things like this, so if that's not a possibility then an API that the library's client is expected to call, should be fine perhaps?