1. Travis Shirk
  2. eyeD3
  3. Issues
Issue #91 resolved

Don't configure global logging settings when imported as a library

created an issue

src/eyed3/utils/log.py changes global logging configuration. That's fine when eyeD3 is used as a CLI tool, but not when eyeD3 is imported by other code. Libraries shouldn't change global logging configuration.

One simple solution is to expose _initLogging() in log.py and move initLogging() to src/eyed3/main.py.

Until fixed, if anyone bumps into this problem, a workaround is to revert eyeD3's global logging modifications post import, like

import eyed3

Comments (4)

  1. Isaac Hailperin

    Thank you for the hint!

    In order for eyed3 logging to fit into my applications logging, I had to add

    ch = logging.StreamHandler()
    ch_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    # this is the relevant part, the previous is just for context

    Just in case it helps anyone.

  2. Log in to comment