Merge pull request 'Improve logging' (#101) from 100-logging-improvements into main
Reviewed-on: #101 Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
commit
4bdbd0febb
|
@ -51,7 +51,7 @@ args=('/dev/log', handlers.SysLogHandler.LOG_MAIL)
|
|||
# Default Postfix log format.
|
||||
#
|
||||
[formatter_postfixfmt]
|
||||
format=%(asctime)s %(module)s[%(process)d]: %(message)s
|
||||
format=%(asctime)s %(name)s[%(process)d]: %(message)s
|
||||
datefmt=%b %e %H:%M:%S
|
||||
style=%
|
||||
validate=True
|
||||
|
|
|
@ -49,8 +49,8 @@ class MailEncryptionProxy:
|
|||
LOG.exception("Got exception while processing", exc_info=te)
|
||||
return RESULT_ERROR
|
||||
|
||||
ellapsed = time.process_time() - start
|
||||
LOG.info(f'Message delivered in {ellapsed} ms')
|
||||
ellapsed = (time.process_time() - start) * 1000
|
||||
LOG.info(f'Message delivered in {ellapsed:.2f} ms')
|
||||
return RESULT_OK
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,11 @@ class KeyCache:
|
|||
"""Check if cache contains a key assigned to the given email."""
|
||||
return email in self._keys.values()
|
||||
|
||||
def __repr__(self):
|
||||
"""Return text representation of this object."""
|
||||
details = ' '.join(self._keys.keys())
|
||||
return f'<KeyCache {details}>'
|
||||
|
||||
|
||||
class KeyRing:
|
||||
"""A high-level adapter for GnuPG-maintained keyring directory.
|
||||
|
|
|
@ -189,9 +189,7 @@ def _identify_gpg_recipients(recipients, keys: kcache.KeyCache):
|
|||
|
||||
# GnuPG keys found in our keyring.
|
||||
|
||||
LOG.info(f'Processisng recipients: {recipients!r}; keys: {keys!r}')
|
||||
for to in recipients:
|
||||
LOG.info(f"At to={to!r}")
|
||||
own_key = _try_configured_key(to, keys)
|
||||
if own_key is not None:
|
||||
gpg_to.append(GpgRecipient(own_key[0], own_key[1]))
|
||||
|
|
|
@ -18,7 +18,7 @@ formatter=postfixfmt
|
|||
args=('test/logs/lacre.log', 'a+')
|
||||
|
||||
[formatter_postfixfmt]
|
||||
format=%(asctime)s %(module)s[%(process)d]: %(message)s
|
||||
format=%(asctime)s %(name)s[%(process)d]: %(message)s
|
||||
datefmt=%b %e %H:%M:%S
|
||||
style=%
|
||||
validate=True
|
||||
|
|
Loading…
Reference in New Issue