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.
|
# Default Postfix log format.
|
||||||
#
|
#
|
||||||
[formatter_postfixfmt]
|
[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
|
datefmt=%b %e %H:%M:%S
|
||||||
style=%
|
style=%
|
||||||
validate=True
|
validate=True
|
||||||
|
|
|
@ -49,8 +49,8 @@ class MailEncryptionProxy:
|
||||||
LOG.exception("Got exception while processing", exc_info=te)
|
LOG.exception("Got exception while processing", exc_info=te)
|
||||||
return RESULT_ERROR
|
return RESULT_ERROR
|
||||||
|
|
||||||
ellapsed = time.process_time() - start
|
ellapsed = (time.process_time() - start) * 1000
|
||||||
LOG.info(f'Message delivered in {ellapsed} ms')
|
LOG.info(f'Message delivered in {ellapsed:.2f} ms')
|
||||||
return RESULT_OK
|
return RESULT_OK
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,11 @@ class KeyCache:
|
||||||
"""Check if cache contains a key assigned to the given email."""
|
"""Check if cache contains a key assigned to the given email."""
|
||||||
return email in self._keys.values()
|
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:
|
class KeyRing:
|
||||||
"""A high-level adapter for GnuPG-maintained keyring directory.
|
"""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.
|
# GnuPG keys found in our keyring.
|
||||||
|
|
||||||
LOG.info(f'Processisng recipients: {recipients!r}; keys: {keys!r}')
|
|
||||||
for to in recipients:
|
for to in recipients:
|
||||||
LOG.info(f"At to={to!r}")
|
|
||||||
own_key = _try_configured_key(to, keys)
|
own_key = _try_configured_key(to, keys)
|
||||||
if own_key is not None:
|
if own_key is not None:
|
||||||
gpg_to.append(GpgRecipient(own_key[0], own_key[1]))
|
gpg_to.append(GpgRecipient(own_key[0], own_key[1]))
|
||||||
|
|
|
@ -18,7 +18,7 @@ formatter=postfixfmt
|
||||||
args=('test/logs/lacre.log', 'a+')
|
args=('test/logs/lacre.log', 'a+')
|
||||||
|
|
||||||
[formatter_postfixfmt]
|
[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
|
datefmt=%b %e %H:%M:%S
|
||||||
style=%
|
style=%
|
||||||
validate=True
|
validate=True
|
||||||
|
|
Loading…
Reference in New Issue