2

Take a look at this link: https://docs.python.org/3/library/logging.html#levels

They talk about logging levels where DEBUG has a numeric value of 10, INFO has a numeric value of 20.

I am looking at a program where handler.setLevel(level=15) was used. Obviously, this is a custom logging level. How to add one is discussed in this answer: Python3 add logging level

I found the logging documentation to be inadequate in answering these questions:

  • What does 15 mean in context of logging?
  • Does it mean it's almost DEBUG? Why not just use INFO level?
Intrastellar Explorer
  • 3,005
  • 9
  • 52
  • 119
  • Possible duplicate of [Python3 add logging level](https://stackoverflow.com/questions/47888855/python3-add-logging-level) – cullzie Mar 27 '19 at 23:50

1 Answers1

2

What does 15 mean in context of logging? Does it mean it's almost DEBUG?

It means something higher than DEBUG (10) yet lower than INFO (20).

Why not just use INFO level?

In stdlib logging it's possible to add your own custom levels. See logging.addLevelName for example. In practice, it's not uncommon for third party code to use a TRACE level (5) for sub-DEBUG logging.

It's likely that something in the program you're looking at has added a level between DEBUG and INFO when configuring logging.

wim
  • 338,267
  • 99
  • 616
  • 750
  • Can you make up an example when you would want to use something between `DEBUG` and `INFO`? Why wouldn't you just use `DEBUG`? – Intrastellar Explorer Mar 28 '19 at 00:52
  • 1
    For when DEBUG is too verbose and INFO is not verbose enough? Actually happens to me a lot, to be honest.. – wim Mar 28 '19 at 01:01