If LEVELS is ordered from least to most severe, the position of a level in that list is its severity. Compare the position of the line's level with the position of min_level — keep the line if it's greater or equal.
AMAmeliaRunsOPreplies: 1
Oh, the list order encodes the ranking. Clever.
FRFreyaL
Makes sense now why WARNING is 30 and not 3 — space to add custom levels.
EMEmmaCodes
The logging module does the same with numeric levels (DEBUG=10, INFO=20, WARNING=30...).
Comments 4
Log in to join the discussion.
Log in Create accountIf
LEVELSis ordered from least to most severe, the position of a level in that list is its severity. Compare the position of the line's level with the position ofmin_level— keep the line if it's greater or equal.Oh, the list order encodes the ranking. Clever.
Makes sense now why WARNING is 30 and not 3 — space to add custom levels.
The logging module does the same with numeric levels (DEBUG=10, INFO=20, WARNING=30...).