rephrased differently, why other handlers like StreamHandler (inheriting Handler), FileHandler (inheriting StreamHandler) don’t have this really handy level
argument in their constructor?
Because it’s an implementation detail. You aren’t meant to instantiate the base Handler type directly.
Having the level
argument in the base class makes it possible to implement a custom handler that calls super
with a different default level (instead of NOTSET
) – so in that sense, it’s perhaps not merely an implementation detail. But the intended (or most common) usage seems to be that level
is set either by using a particular config (as in logging.basicConfig
which can specify the level) or by directly calling Logger.setLevel
.