summaryrefslogtreecommitdiff
path: root/giscanner/message.py
diff options
context:
space:
mode:
authorMikhail Zabaluev <mikhail.zabaluev@gmail.com>2015-09-30 19:30:30 +0300
committerColin Walters <walters@verbum.org>2015-09-30 13:32:28 -0400
commit1be0372c2f6653f0a434e88ef1431507bd47e33d (patch)
tree6cf72d236d2e2b1c91a19132851ada5a09c73456 /giscanner/message.py
parent474cab7c980c1bcbc17b8f5eb4363a6f740593d1 (diff)
downloadgobject-introspection-1be0372c2f6653f0a434e88ef1431507bd47e33d.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=755890
Diffstat (limited to 'giscanner/message.py')
-rw-r--r--giscanner/message.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/giscanner/message.py b/giscanner/message.py
index 065ee253..e79a8131 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -97,7 +97,7 @@ class Position(object):
class MessageLogger(object):
_instance = None
- def __init__(self, namespace, output=None):
+ def __init__(self, namespace=None, output=None):
if output is None:
output = sys.stderr
self._cwd = os.getcwd()
@@ -158,8 +158,12 @@ class MessageLogger(object):
text = '%s\n%s\n%s' % (text, marker_line, ' ' * marker_pos + '^')
if prefix:
- text = ('%s: %s: %s: %s: %s\n' % (last_position, error_type,
- self._namespace.name, prefix, text))
+ if self._namespace:
+ text = ('%s: %s: %s: %s: %s\n' % (last_position, error_type,
+ self._namespace.name, prefix, text))
+ else:
+ text = ('%s: %s: %s: %s\n' % (last_position, error_type,
+ prefix, text))
else:
if self._namespace:
text = ('%s: %s: %s: %s\n' % (last_position, error_type,