arxiv.py icon indicating copy to clipboard operation
arxiv.py copied to clipboard

Use Python logging best practices

Open lukasschwab opened this issue 3 years ago • 1 comments

Motivation

A clear and concise description of what the problem is. For example, "I'm always frustrated when..."

  • Change how logging is exposed. Setting the logging level is difficult. There must be a standard Python pattern for this, e.g. using a named logger with a name other than __name__.
  • Change internal logging usage: logging upon error construction can be misleading, esp. when errors are nonterminal (i.e. resolved in retries). https://github.com/lukasschwab/arxiv.py/issues/43#issuecomment-817890164

Solution

A clear and concise description of what you want to happen.

TODO

lukasschwab avatar Apr 12 '21 19:04 lukasschwab

This was improved with 347327a, but there's still room for improvement.

  • Standardizing log messaging (e.g. punctuation).
  • Promoting essential extra fields into messages. Standardizing extra field names to make them easier to format.
  • Unit tests for evergreen logging behavior, e.g. logging retries.
  • Creating child loggers for each .get() generator.

Wouldn't mind some input from someone confident in their Python logging patterns.

lukasschwab avatar Apr 17 '21 03:04 lukasschwab