Skip to content

Move logging setup to main #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions code2flow/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def code2flow(raw_source_paths, output_file, language=None, hide_legend=True,
exclude_namespaces=None, exclude_functions=None,
include_only_namespaces=None, include_only_functions=None,
no_grouping=False, no_trimming=False, skip_parse_errors=False,
lang_params=None, subset_params=None, level=logging.INFO):
lang_params=None, subset_params=None):
"""
Top-level function. Generate a diagram based on source code.
Can generate either a dotfile or an image.
Expand Down Expand Up @@ -708,8 +708,6 @@ def code2flow(raw_source_paths, output_file, language=None, hide_legend=True,
include_only_functions = include_only_functions or []
assert isinstance(include_only_functions, list)

logging.basicConfig(format="Code2Flow: %(message)s", level=level)

sources, language = get_sources_and_language(raw_source_paths, language)

output_ext = None
Expand Down Expand Up @@ -857,6 +855,7 @@ def main(sys_argv=None):
subset_params = SubsetParams.generate(args.target_function, args.upstream_depth,
args.downstream_depth)

logging.basicConfig(format="Code2Flow: %(message)s", level=level)
code2flow(
raw_source_paths=args.sources,
output_file=args.output,
Expand All @@ -871,5 +870,4 @@ def main(sys_argv=None):
skip_parse_errors=args.skip_parse_errors,
lang_params=lang_params,
subset_params=subset_params,
level=level,
)