crypt: Use a sublogger of pgp_mime.LOG not pyassuan.LOG for clients.
authorW. Trevor King <wking@tremily.us>
Thu, 20 Sep 2012 11:05:37 +0000 (07:05 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 20 Sep 2012 11:05:37 +0000 (07:05 -0400)
This way tools like pygrader that setup a SysLogHandler for
pgp_mime.LOG wont have pyassuan still logging to the console.  The
name-order for the logger also changed (from `pyassuan.pgp-mime` to
`pgp-mime.pyassuan`).

pgp_mime/crypt.py

index b3c29e756c75f4cb0ec602442230bf4026557651..82a0cacf386fc5e6abd09f8899580459539103a0 100644 (file)
@@ -46,8 +46,10 @@ def connect(client, filename, **kwargs):
     return socket
 
 def get_client(**kwargs):
-    client = _client.AssuanClient(name='pgp-mime', close_on_disconnect=True)
-    client.logger.setLevel(_LOG.level)
+    logger = _logging.getLogger('{}.{}'.format(_LOG.name, 'pyassuan'))
+    client = _client.AssuanClient(
+        name='pgp-mime', logger=logger, use_sublogger=False,
+        close_on_disconnect=True)
     socket = connect(client, '~/src/gpgme/build/src/gpgme-tool', **kwargs)
     #socket = connect(client, '~/.assuan/S.gpgme-tool', **kwargs)
     return (client, socket)