mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
710 stars 53 forks source link

Log messages appearing twice with Python Logging after itable import #265

Closed anstiwar closed 2 months ago

anstiwar commented 2 months ago

After importing itables in my Python code, All Log messages appearing twice with Python Logging python version: 3.9.12 itables version: 2.0.0

import logging

# create logger
logger = logging.getLogger('simple_example')
logger.setLevel(logging.DEBUG)

# create console handler and set level to debug
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

# create formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

# add formatter to ch
ch.setFormatter(formatter)

# add ch to logger
logger.addHandler(ch)

## print some message
logger.info("hello test")    #### till this point all looks good

## now import itables
import itables

## use the logger again , now the same logger.info printing the log message twice
logger.info("hello test after import")

image

mwouts commented 2 months ago

Thanks @anstiwar for the detailed report! This will be fixed in the next release following this commit: https://github.com/mwouts/itables/commit/e93ee9ea1a2e1d116d294c2d387c9c14660994aa

anstiwar commented 2 months ago

Thanks @mwouts for the quick fix, tested the code with the latest itables version and it's working.

Thanks again

mwouts commented 2 months ago

Your welcome! Thanks for your quick feedback too!