aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mlog.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-12-30 15:45:28 -0500
committerXavier Claessens <xclaesse@gmail.com>2019-01-16 11:16:46 -0500
commit815f1205a8d2eb78fa71057c593f4eec3746aad3 (patch)
tree31ec4c012c7c577a002f47dd02aa7096b5ba17a8 /mesonbuild/mlog.py
parentaf643d64096ab85df5fc65aad9713ea4bed63f4e (diff)
downloadmeson-815f1205a8d2eb78fa71057c593f4eec3746aad3.zip
meson-815f1205a8d2eb78fa71057c593f4eec3746aad3.tar.gz
meson-815f1205a8d2eb78fa71057c593f4eec3746aad3.tar.bz2
do_subproject: Improve log messages and formatting
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r--mesonbuild/mlog.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index 57debb0..a8b146f 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -195,12 +195,15 @@ def warning(*args, **kwargs):
def deprecation(*args, **kwargs):
return _log_error('deprecation', *args, **kwargs)
-def exception(e):
+def exception(e, prefix=red('ERROR:')):
log()
+ args = []
if hasattr(e, 'file') and hasattr(e, 'lineno') and hasattr(e, 'colno'):
- log('%s:%d:%d:' % (e.file, e.lineno, e.colno), red('ERROR: '), e)
- else:
- log(red('ERROR:'), e)
+ args.append('%s:%d:%d:' % (e.file, e.lineno, e.colno))
+ if prefix:
+ args.append(prefix)
+ args.append(e)
+ log(*args)
# Format a list for logging purposes as a string. It separates
# all but the last item with commas, and the last with 'and'.