Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GLib logging framework instead of custom code
The idea here is to use a common logging framework that is available for us in a library we already use in many other places -- GLib. This means: * We can get rid of quite a big chunk of a custom logging code which was just blindly printing things to STDOUT and logging via the old syslog() API. Plus all the logic for setting colors, bold fonts, etc. All this happening even if debug logging was disabled with the '--no-debug' option in which case all would have been done in vain because the output was in the end written to '/dev/null'. * We can use GLib's function(s) for structured logging (IOW, journal). This means that our (system) logs should be easier to work with as we can split what used to be a single string/message into fields with some semantic meaning (the major one still being the logged MESSAGE, of course). * Our custom colors are gone. But worry no longer if you become addicted to them! GLib logging uses colors too when they detect that they have some usable STDOUT/STDERR. So it's still easy to spot the serious in the output. * Messages that used to be ERROR are now CRITICAL because logging an ERROR also means calling abort() with GLib logging. That's quite unfortunate, I think, but at the same time not a big deal, really. Turns out we actually should exit early in some places where we were just logging ERROR messages, but for that we need to change our clean-up code to be registered as an atexit() handler so that we can just terminate and rely on the clean-up to be executed automatically. * NOTICE messages are now MESSAGE because GLib logging doesn't know anything like a NOTICE log level (don't know why as it's a syslog level). Again, no big deal as we can keep our udisks_notice() macro and just use a different level for it. Plus a new udisks_message() macro for people used to GLib logging and it's MESSAGE level. * DEBUG and INFO messages are discarded by default. But see the follow up commit that deals with this.
- Loading branch information
Showing
17 changed files
with
70 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.