From 5e4cb07095ba1a6ee848b517af3bb7d3649e219f Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 22 Sep 2016 16:20:36 +0100 Subject: [PATCH] Add "set_log_level" to python wrapper --- python/olm/__init__.py | 1 + python/olm/__main__.py | 5 +++++ python/olm/account.py | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/python/olm/__init__.py b/python/olm/__init__.py index 31b29b9..71b5400 100644 --- a/python/olm/__init__.py +++ b/python/olm/__init__.py @@ -1,4 +1,5 @@ from .account import Account +from .account import set_log_level from .session import Session from .outbound_group_session import OutboundGroupSession from .inbound_group_session import InboundGroupSession diff --git a/python/olm/__main__.py b/python/olm/__main__.py index a34d52a..fe12d1e 100755 --- a/python/olm/__main__.py +++ b/python/olm/__main__.py @@ -13,6 +13,8 @@ from . import * def build_arg_parser(): parser = argparse.ArgumentParser() parser.add_argument("--key", help="Account encryption key", default="") + parser.add_argument("--log-level", help="Log level", type=int, default=None) + commands = parser.add_subparsers() create_account = commands.add_parser("create_account", help="Create a new account") @@ -344,4 +346,7 @@ def do_group_decrypt(args): if __name__ == '__main__': parser = build_arg_parser() args = parser.parse_args() + if args.log_level is not None: + set_log_level(args.log_level) + args.func(args) diff --git a/python/olm/account.py b/python/olm/account.py index 7673329..94ce56a 100644 --- a/python/olm/account.py +++ b/python/olm/account.py @@ -2,6 +2,11 @@ import json from ._base import * +lib.olm_set_log_level.argtypes = [c_uint] +lib.olm_set_log_level.restype = None + +set_log_level = lib.olm_set_log_level + lib.olm_account_size.argtypes = [] lib.olm_account_size.restype = c_size_t