I would be in favor of using module-level loggers as well. I think per-class would be overkill and unlike Java not everything is in a class, as well as being more conventional in Python (where modules are generally seen as the unit of compilation, vs. Java where classes are the unit of compilation and there's really no analogous of modules (short of say a static-member only class, packages aren't the same thing)).
On Wed, Nov 13, 2019 at 9:22 AM Luke Cwik <[email protected]> wrote: > > That doesn't seem like a very invasive change so if we adopt it we should > adopt it everywhere in the same CL so people see the common pattern and use > it. > > I'm for using a named logger and would rather that it is per class instead of > per module since many of the modules have lots of classes but +1 from me > overall. > > On Tue, Nov 12, 2019 at 4:37 PM Pablo Estrada <[email protected]> wrote: >> >> Hi all, >> as of today, the Python SDK uses the root logger wherever we log. This means >> that it's impossible to have different logging levels depending on the >> section of the code that we want to debug most. >> >> I have been doing some work on the FnApiRunner, and adding logging for it. I >> would like to start using a logger hierarchy, and slowly transition the rest >> of the project to use per-module loggers. >> >> On each module, we could have a line like so: >> >> _LOGGER = logging.getLogger(__name__) >> >> and simply log everything on that _LOGGER. Is that an acceptable thing to do >> for everyone? >> >> If I see no objections, I will change the FnApiRunner to use a logger like >> this, and change other sections of the code as I interact with them. >> Best >> -P.
