|Summary:||Make debug levels an enum|
|Product:||libfprint||Reporter:||Bastien Nocera <bugzilla>|
|Status:||RESOLVED FIXED||QA Contact:|
|i915 platform:||i915 features:|
Description Bastien Nocera 2018-05-17 11:20:19 UTC
fp_set_debug() should use an enum instead of magic numbers.
Comment 1 Bastien Nocera 2018-05-17 11:21:04 UTC
Or use GLib's log levels instead, as we already use GLib internally anyway.
Comment 2 Bastien Nocera 2018-05-22 17:02:08 UTC
Philip Withnall looked at this and mentioned that we should: "Just define them to the same values as the GLogLevel ones, since they’re never going to change" "You could add G_STATIC_ASSERT (FP_LOG_LEVEL_DEBUG == G_LOG_LEVEL_DEBUG) in your .c file to ensure the APIs don’t slide out of sync" fpi_log_level also looks to be the internal-only version of that enum.
Comment 3 Bastien Nocera 2018-05-23 17:17:08 UTC
I actually went a different way, as using the same log levels as GLib would have required API changes, and no application actually uses fp_set_debug() anyway, as the application would require special handling for its debug mode. I just nuked the internal logging code and made it use the GLib ones directly, and documented how to change the internal libfprint and libusb debug outputs. commit 32fcfde86b3d57305c29b545aa084d28c7c76fe9 Author: Bastien Nocera <email@example.com> Date: Wed May 23 17:48:55 2018 +0200 lib: Use GLib and libusb directly for debug output Use GLib internally to output debug information, and tell about libusb's LIBUSB_DEBUG envvar for libusb debug. fp_set_debug() is now a no-op. https://bugs.freedesktop.org/show_bug.cgi?id=106552