datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
86 stars 12 forks source link

Propose best practices for Django management command logging #100

Closed jeancochrane closed 10 months ago

jeancochrane commented 4 years ago

Documentation request

From https://github.com/datamade/devops/issues/110#issuecomment-553624525:

What is our standard for Django management command logging? We seem to use a mix of styles and frameworks, both within and between projects.

Some points in favor of using the built-in Django management command logging:

  • Pretty simple to use
  • Unbuffered by default
  • Exposes verbosity flags

Points in favor of using Python's logging module:

  • Framework-agnostic, so knowledge of it generalizes to non-Django Python projects
  • Granular control over log levels; doesn't uniformly print to stdout
  • Easier to capture during testing

If we decide we want to use something different than the built-in logging, this could make a good mini Django app. In fact, such an app may already exist.