Skip to content
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

Fixed OVC logger. #27837

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions tools/ovc/openvino/tools/ovc/convert_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ def check_model_object(argv):


def driver(argv: argparse.Namespace, non_default_params: dict):
init_logger('ERROR', argv.verbose)

# Log dictionary with non-default cli parameters where complex classes are excluded.
log.debug(str(non_default_params))

Expand Down Expand Up @@ -433,7 +431,11 @@ def _convert(cli_parser: argparse.ArgumentParser, args, python_api_used):
telemetry.send_event('ovc', 'version', simplified_ie_version)
# Initialize logger with 'ERROR' as default level to be able to form nice messages
# before arg parser deliver log_level requested by user
init_logger('ERROR', False)
verbose = False
if "verbose" in args and args["verbose"] or "--verbose" in sys.argv:
verbose = True

init_logger('ERROR', verbose, python_api_used)
argv = None
# Minimize modifications among other places in case if multiple pieces are passed as input_model
if python_api_used:
Expand Down
5 changes: 4 additions & 1 deletion tools/ovc/openvino/tools/ovc/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def filter(self, record: log.LogRecord):
return True # if regex wasn't set print all logs


def init_logger(lvl: str, verbose: bool):
def init_logger(lvl: str, verbose: bool, python_api_used: bool):
if verbose and python_api_used:
# We need to not override logger in case of verbose=True to allow user set a log level
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can user set logger level? In help, there is no info about it.

return
global handler_num
log_exp = os.environ.get('MO_LOG_PATTERN')
if not verbose:
Expand Down
Loading