Skip to content

code2flow changes configuration of loggers #95

Open

Description

@maxjeblick

When calling code2flow within python (i.e. not via cmd line), the default logging config is overwritten:
logging.basicConfig(format="Code2Flow: %(message)s", level=level)

This is a bit annoying, as it requires to reconfigure logging after calling code2flow to remove Code2Flow prefix.

Activity

  1. added 2 commits that reference this issue on May 8, 2024
    dbfd415
    a1b5946
  2. pawamoy commented on Jul 12, 2024

    @pawamoy

    Yep, agree. Code2Flow should only call logging.basicConfig() from its main entrypoint, not from the code2flow function, which is documented as programmatic use.

  3. pawamoy commented on Jul 12, 2024

    @pawamoy

    Oh, worse than that, it uses the root logger, so we can't even disable logging for code2flow only with something like this:

    logging.getLogger("code2flow").setLevel(logging.CRITICAL + 1)

    Code2Flow should get its own logger with logger = logging.getLogger("code2flow") 🙂

  4. pawamoy commented on Jul 12, 2024

    @pawamoy

    I was able to disable code2flow.engine's logging with this:

    from unittest.mock import MagicMock
    from code2flow import engine
    
    engine.logging = MagicMock()
  5. maxjeblick commented on Jul 15, 2024

    @maxjeblick
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions