jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.23k stars 330 forks source link

global logging prevents any application to log #199

Closed Maradonna90 closed 3 years ago

Maradonna90 commented 3 years ago

The Logging to file example from python docs is not working when importing pybaseball https://docs.python.org/3/howto/logging.html#logging-from-multiple-modules

# myapp.py
import logging
import mylib

def main():
    logging.basicConfig(filename='myapp.log', level=logging.INFO)
    logging.info('Started')
    mylib.do_something()
    logging.info('Finished')

if __name__ == '__main__':
    main()
# mylib.py
import logging

def do_something():
    logging.info('Doing something')

Getting a logger from logging also doesn't work as intended