flask-expects-json icon indicating copy to clipboard operation
flask-expects-json copied to clipboard

Logging validation errors

Open tzachyrm opened this issue 3 years ago • 2 comments

tzachyrm avatar Jun 17 '21 10:06 tzachyrm

@Fischerfredl any chance to merge this? Thanks!

tzachyrm avatar Jun 17 '21 10:06 tzachyrm

Hi @tzachyrm,

thank you for your pull request.

To incorporate logging, i would like to conform to standard logging practices.

See:

  • https://docs.python.org/3/howto/logging.html
    • Specifically https://docs.python.org/3/howto/logging.html#advanced-logging-tutorial
    • and https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
  • https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library

I propose the following changes

  • [ ] Leave the function interface as is
  • [ ] create a logger based on __name__
  • [ ] Use a fixed log level for logging
    • I'd consider failing validation and decoding as "events that occur during normal operation of a program" so info or debug would be more appropriate
  • [ ] document logging in README.md
  • [ ] Nice to have: tests

With those changes I wouldn't see a reason not to merge this.

Fischerfredl avatar Jun 22 '21 06:06 Fischerfredl