crypt: Use a sublogger of pgp_mime.LOG not pyassuan.LOG for clients.
[pgp-mime.git] / pgp_mime / crypt.py
index 40d4572c5ca6aff846c3680ab7960272f40a62bd..82a0cacf386fc5e6abd09f8899580459539103a0 100644 (file)
@@ -1,4 +1,18 @@
-# Copyright
+# Copyright (C) 2012 W. Trevor King <wking@tremily.us>
+#
+# This file is part of pgp-mime.
+#
+# pgp-mime is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# pgp-mime is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# pgp-mime.  If not, see <http://www.gnu.org/licenses/>.
 
 import codecs as _codecs
 import logging as _logging
@@ -32,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(_logging.DEBUG)
+    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)