summaryrefslogtreecommitdiff
path: root/src/leap/mx/util
diff options
context:
space:
mode:
authorIsis Lovecruft <isis@torproject.org>2013-02-18 17:45:07 +0000
committerIsis Lovecruft <isis@torproject.org>2013-02-18 17:45:07 +0000
commit8f7ebd8e388a96dd825ee3cc7a72850b51dbca8b (patch)
tree3117136c18217ae2e53028aec8d464702a6f6fe9 /src/leap/mx/util
parented0be24a1053f370b60f315e26ed52d350c4063e (diff)
Add option to config to enable/disable warnings in the logger, and fix the
print statements in the logger to be the py3k print_function.
Diffstat (limited to 'src/leap/mx/util')
-rw-r--r--src/leap/mx/util/config.py4
-rw-r--r--src/leap/mx/util/log.py10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/leap/mx/util/config.py b/src/leap/mx/util/config.py
index f655ca9..f0f1bbb 100644
--- a/src/leap/mx/util/config.py
+++ b/src/leap/mx/util/config.py
@@ -87,6 +87,8 @@ def _create_config_file(conffile):
#
basic:
+ # Should we print warnings to stdout and, if enabled, the logfile?:
+ show_warnings: True
# Whether or not to log to file:
enable_logfile: True
# The name of the logfile:
@@ -111,7 +113,7 @@ advanced:
debug: True
# Print enough things really fast to make you look super 1337:
noisy: False
-config_version: 0.0.2
+config_version: 0.0.3
""")
conf.flush()
diff --git a/src/leap/mx/util/log.py b/src/leap/mx/util/log.py
index f31684d..4f2b4e5 100644
--- a/src/leap/mx/util/log.py
+++ b/src/leap/mx/util/log.py
@@ -9,6 +9,8 @@ Logging for leap_mx.
@copyright: 2013 Isis Agora Lovecruft
'''
+from __future__ import print_function
+
from datetime import datetime
from functools import wraps
@@ -85,22 +87,22 @@ def start(logfilename=None, logfiledir=None):
def msg(msg, *arg, **kwarg):
"""Log a message at the INFO level."""
- print "[*] %s" % msg
+ print("[*] %s" % msg)
def debug(msg, *arg, **kwarg):
"""Log a message at the DEBUG level."""
if config.advanced.debug:
- print "[d] %s" % msg
+ print("[d] %s" % msg)
def warn(msg, *arg, **kwarg):
"""Log a message at the WARN level."""
if config.basic.show_warnings:
txlog.logging.captureWarnings('true')
- print "[#] %s" % msg
+ print("[#] %s" % msg)
def err(msg, *arg, **kwarg):
"""Log a message at the ERROR level."""
- print "[!] %s" % msg
+ print("[!] %s" % msg)
def fail(*failure):
"""Log a message at the CRITICAL level."""