# if you call addHandler() within the code of your function, it will continue to add
# duplicate handlers to the logging singleton every time the function runs.
# so to solve this you clear the existing handler
logging.getLogger().handlers.clear()
logging.getLogger().addHandler(...)