You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Yep, agree. Code2Flow should only call logging.basicConfig() from its main entrypoint, not from the code2flow function, which is documented as programmatic use.
Activity
Move logging setup to main (fixes scottrogowski#95)
Move logging setup to main (fixes scottrogowski#95)
pawamoy commentedon Jul 12, 2024
Yep, agree. Code2Flow should only call
logging.basicConfig()from itsmainentrypoint, not from thecode2flowfunction, which is documented as programmatic use.pawamoy commentedon Jul 12, 2024
Oh, worse than that, it uses the root logger, so we can't even disable logging for code2flow only with something like this:
Code2Flow should get its own logger with
logger = logging.getLogger("code2flow")🙂pawamoy commentedon Jul 12, 2024
I was able to disable
code2flow.engine's logging with this:maxjeblick commentedon Jul 15, 2024
I implemeted a similar fix using
mock.patch.objectcontextmanagerhttps://github.com/maxjeblick/llm-docstring-generator/blob/main/llm_docstring_generator/sorters/code2flow_patched.py#L25