Further to my previous blog post on error-reporting in libgeda, I've made some pretty good progress on implementing the ideas that I described. In particular:
- The file opening functions (f_open() and f_open_flags) now use GError to return error messages rather than just spewing them to the console.
- gschem now shows an informative dialog box when it fails to load a file.
- All programs now actually tell you the real reason for failing to load a file (e.g. "Permission denied" or "File does not exist") rather than just giving a generic "Could not open file" message.
- The libgeda logging mechanism now handles most levels of GLib log message rather than just the "message" level (seeing as the log is most useful when some sort of error has occurred, this seems sensible).
- gschem now highlights warnings and errors in the log window.
- Lots of ways in which libgeda could randomly kill your program have been eradicated.
These changes are not yet in the unstable branch, but barring someone objecting to my changes I'll push them upstream tomorrow sometime.
The next (probably thankless) task is to work through libgeda converting all calls to directly output debugging/error-reporting information to the console to use the GLib logging functions instead, and to make log messages be sent at appropriate levels rather than all at the "message" level (this will allow filtering of log messages in the gschem log window, for instance).
I'm still of two minds about the best way to do this. Currently, libgeda defines a macro s_log_message() which is equivalent to GLib's g_message(). For adding logging at multiple levels, the two options are:
- Get rid of s_log_message entirely, and just use the GLib logging macros directly.
- Define s_log_debug, s_log_warning etc so that the exact implementation could be easily modified at a later date (e.g. for the purpose of making libgeda always log in the "libgeda" log domain).
I'm currently leaning towards the latter, but haven't as yet made up my mind about exactly which will be the best way to go.
No comments:
Post a Comment