Restore log setup method incorrectly removed in log refactoring
Change-Id: I300bb440b2964478d2fa11726c14b4842b142f0d
diff --git a/xos/xos_client/xosapi/xos_grpc_client.py b/xos/xos_client/xosapi/xos_grpc_client.py
index 38f91c2..f8815ed 100644
--- a/xos/xos_client/xosapi/xos_grpc_client.py
+++ b/xos/xos_client/xosapi/xos_grpc_client.py
@@ -189,6 +189,20 @@
return args
+def setup_logging(args):
+ import logging
+ import structlog
+
+ verbosity_adjust = (args.verbose or 0) - (args.quiet or 0)
+ logging.basicConfig()
+ logger = logging.getLogger()
+ logger.setLevel(logging.DEBUG - 10*verbosity_adjust)
+
+ def logger_factory():
+ return logger
+
+ structlog.configure(logger_factory=logger_factory)
+
def coreclient_reconnect(client, reconnect_callback, *args, **kwargs):
global coreapi
@@ -219,6 +233,8 @@
args = parse_args()
+ setup_logging(args)
+
if args.username:
start_api(reconnect_callback, endpoint=args.grpc_secure_endpoint, username=args.username, password=args.password)
else: