NONoahLoops6 Oct, 18:45replies: 2If 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.
EMEmmaCodes7 Oct, 07:25The logging module does the same with numeric levels (DEBUG=10, INFO=20, WARNING=30...).
Comments 4
Join the discussion CommentAlready have an account? Log in
If
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...).