Bug 106552 - Make debug levels an enum
Summary: Make debug levels an enum
Status: RESOLVED FIXED
Alias: None
Product: libfprint
Classification: Unclassified
Component: libfprint (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: libfprint-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-17 11:20 UTC by Bastien Nocera
Modified: 2018-05-23 17:17 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

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 <hadess@hadess.net>
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


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.