summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2016-11-06 12:58:01 -0200
committerdrebs <drebs@riseup.net>2016-11-06 14:21:13 -0200
commit501005d7d54bd57a37df4777154f0e47e4dc622c (patch)
tree72ffd31c544faac1e27e84e8199997b3bb8851c4 /src
parent0ed9a016f6b41600f6bfc7b6576f152e6bf6a902 (diff)
[feat] increase verbosity using command line
Diffstat (limited to 'src')
-rwxr-xr-xsrc/leap/bitmask/cli/bitmask_cli.py6
-rw-r--r--src/leap/bitmask/core/bitmaskd.tac3
-rw-r--r--src/leap/bitmask/core/flags.py1
-rw-r--r--src/leap/bitmask/core/launcher.py2
4 files changed, 10 insertions, 2 deletions
diff --git a/src/leap/bitmask/cli/bitmask_cli.py b/src/leap/bitmask/cli/bitmask_cli.py
index c27cabfc..4f275d9c 100755
--- a/src/leap/bitmask/cli/bitmask_cli.py
+++ b/src/leap/bitmask/cli/bitmask_cli.py
@@ -92,7 +92,11 @@ GENERAL COMMANDS:
# XXX careful! Should see if the process in PID is running,
# avoid launching again.
import commands
- commands.getoutput('bitmaskd')
+ cmd = 'bitmaskd'
+ if raw_args and '--verbose' in raw_args:
+ cmd += ' --verbose'
+ commands.getoutput(cmd)
+ command.default_dict_printer({'start': 'ok'})
return defer.succeed(None)
def version(self, raw_args):
diff --git a/src/leap/bitmask/core/bitmaskd.tac b/src/leap/bitmask/core/bitmaskd.tac
index 0ab44ff3..e2733f94 100644
--- a/src/leap/bitmask/core/bitmaskd.tac
+++ b/src/leap/bitmask/core/bitmaskd.tac
@@ -12,6 +12,7 @@ from twisted.logger import LogLevel
from twisted.logger import LogLevelFilterPredicate
from twisted.logger import formatEventAsClassicLogText as formatEvent
+from leap.bitmask.core import flags
from leap.bitmask.core.service import BitmaskBackend
from leap.bitmask.core.logs import logFileFactory
@@ -21,7 +22,7 @@ application = service.Application("bitmaskd")
# configure logging
log_file = logFileFactory()
file_observer = FileLogObserver(log_file, formatEvent)
-level = LogLevel.debug if os.environ.get('BITMASK_DEBUG') else LogLevel.info
+level = LogLevel.debug if flags.VERBOSE else LogLevel.info
predicate = LogLevelFilterPredicate(defaultLogLevel=level)
observer = FilteringLogObserver(file_observer, [predicate])
application.setComponent(ILogObserver, observer)
diff --git a/src/leap/bitmask/core/flags.py b/src/leap/bitmask/core/flags.py
index 9a40c70c..12905d3d 100644
--- a/src/leap/bitmask/core/flags.py
+++ b/src/leap/bitmask/core/flags.py
@@ -1 +1,2 @@
BACKEND = 'default'
+VERBOSE = False
diff --git a/src/leap/bitmask/core/launcher.py b/src/leap/bitmask/core/launcher.py
index a02cb23b..d77f367a 100644
--- a/src/leap/bitmask/core/launcher.py
+++ b/src/leap/bitmask/core/launcher.py
@@ -50,6 +50,8 @@ def run_bitmaskd():
for (index, arg) in enumerate(sys.argv):
if arg == '--backend':
flags.BACKEND = sys.argv[index + 1]
+ elif arg == '--verbose':
+ flags.VERBOSE = True
args = [
'-y', join(here(core), "bitmaskd.tac"),
'--logfile', getLogPath(),