alteryx / evalml

EvalML is an AutoML library written in python.
https://evalml.alteryx.com
BSD 3-Clause "New" or "Revised" License
774 stars 86 forks source link

Have all references to the logger be static #343

Closed dsherry closed 4 years ago

dsherry commented 4 years ago

Currently we attach the Logger class to AutoBase, PipelineBase and ComponentBase as instance state:

from evalml.utils import Logger
...
class PipelineBase:
    def __init__(self, ...):
        ....
        self.logger = Logger()
        ....

    def describe(self):
        self.logger.log('Message')

However, there's no reason we need to do that; I'd argue the logger should never be instance state.

I'd like us to move towards a simpler API like this:

from evalml.utils import Logger
logger = Logger()

class PipelineBase:
    def describe(self):
        logger.log('Message')

A related open question is: how do we configure the logger? It supports a verbose option; how do we support enabling that, if necessary? This relates to a more broad question about how config should work for evalml in general. And it could be a separate issue to file; I think progress can be made independently on the proposed logging update.

dsherry commented 4 years ago

Also, perhaps part of this issue can be making sure that we replace any call to print() in our code with a usage of our Logger class