trevorstephens / gplearn

Genetic Programming in Python, with a scikit-learn inspired API
http://gplearn.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.59k stars 281 forks source link

Use logging instead of print #286

Open leapingllamas opened 1 year ago

leapingllamas commented 1 year ago

The output is very chatty, especially progress reports from genetic.py. With most packages, one can apply logging filters outside the code to modify what information is surfaced. For instance, I normally would be able to do something like this in my calling code:

    logger_gplearn = logging.getLogger('gplearn')
    logger_gplearn.setLevel(logging.WARN)

However, as this repo uses print statements instead of logging, this is not possible. Logging is generally best practice as you can control the look and style of the output, show timestamps, line numbers, set levels and so on.

trevorstephens commented 1 year ago

PR welcome ;-)