After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755890 - giscanner.message: Fix module-level logging functions
giscanner.message: Fix module-level logging functions
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-09-30 16:43 UTC by Mikhail Zabaluev
Modified: 2015-10-01 07:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
giscanner.message: Fix module-level logging functions (1.77 KB, patch)
2015-09-30 16:43 UTC, Mikhail Zabaluev
committed Details | Review

Description Mikhail Zabaluev 2015-09-30 16:43:16 UTC
The functions in the module message obtain the MessageLogger instance
by calling MessageLogger.get(). The constructor signature of
MessageLogger, however, requires one mandatory parameter to be used,
that is, the namespace. To make the functions actually work rather
than raising a bogus exception, allow the logger to be constructed
without a namespace parameter.
Comment 1 Mikhail Zabaluev 2015-09-30 16:43:20 UTC
Created attachment 312439 [details] [review]
giscanner.message: Fix module-level logging functions

MessageLogger.get() calls the class constructor without arguments.
The __init__ signature, however, did not default the namespace parameter,
so any usage of the logging functions caused a bogus exception.
Comment 2 Colin Walters 2015-09-30 18:29:30 UTC
Review of attachment 312439 [details] [review]:

Okay, how did this work before?  What are birds?  We just don't know.
Comment 3 Mikhail Zabaluev 2015-10-01 07:30:01 UTC
(In reply to Colin Walters from comment #2)
> Review of attachment 312439 [details] [review] [review]:
> 
> Okay, how did this work before?  What are birds?  We just don't know.

My guess is, any tools that cared for messages prime the logger instance in the main function with something for the namespace, which means any successive MessageLogger.get() gets the same instance regardless of its parameters. Odd design, that.

Note also that enable_warnings() has to be called on the logger with a list of log levels, otherwise no messages will be printed.