latchset / custodia

An API to manage secrets storage and retrieval
GNU General Public License v3.0
85 stars 27 forks source link

Logging cleanup #176

Closed tiran closed 7 years ago

tiran commented 7 years ago

The custom logger factory getLogger() creates logger instances with a special exception() method. The method logs exception stack trace only in debug mode.

In standard mode (INFO), log.exception('message') prints

    message (ExceptionName: exception representation)

In debug mode (DEBUG), log.exception('message') prints

    message
    Traceback (most recent call last):
        ...
        stack trace
        ...
    ExceptionName: exception representation

This will allow us to log API exceptions with log.exception() or self.logger.exception(). Depending on the log level and debug flag, log.exception() either prints a short line or a full traceback for debugging.

codecov-io commented 7 years ago

Codecov Report

Merging #176 into master will increase coverage by 1%. The diff coverage is 89.01%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #176   +/-   ##
=======================================
+ Coverage   60.65%   61.65%   +1%     
=======================================
  Files          36       36           
  Lines        3121     3174   +53     
  Branches      340      342    +2     
=======================================
+ Hits         1893     1957   +64     
+ Misses       1138     1122   -16     
- Partials       90       95    +5
Impacted Files Coverage Δ
tests/test_custodia.py 96.01% <ø> (ø) :arrow_up:
tests/test_cli.py 79.68% <ø> (ø) :arrow_up:
custodia/server/__init__.py 0% <0%> (ø) :arrow_up:
custodia/httpd/server.py 0% <0%> (ø) :arrow_up:
custodia/cli/__init__.py 0% <0%> (ø) :arrow_up:
custodia/client.py 79.6% <100%> (ø) :arrow_up:
custodia/message/kem.py 72.18% <100%> (ø) :arrow_up:
tests/test_misc.py 100% <100%> (ø) :arrow_up:
custodia/message/common.py 82.6% <100%> (ø) :arrow_up:
custodia/plugin.py 66.38% <100%> (-1.1%) :arrow_down:
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a07532b...1d23d81. Read the comment docs.