From 150b4c8e40c3f50ae9c072685d9f413575b56458 Mon Sep 17 00:00:00 2001 From: Dan Moldovan Date: Thu, 13 Dec 2018 10:41:10 -0800 Subject: [PATCH] Use vlog rather then the verbosity level, to allow debugging without changing the code. PiperOrigin-RevId: 225396273 --- tensorflow/python/autograph/impl/api.py | 3 +-- tensorflow/python/autograph/impl/conversion.py | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tensorflow/python/autograph/impl/api.py b/tensorflow/python/autograph/impl/api.py index 0debf24fb94..c113f0e1f5d 100644 --- a/tensorflow/python/autograph/impl/api.py +++ b/tensorflow/python/autograph/impl/api.py @@ -160,8 +160,7 @@ def do_not_convert(run_as=RunMode.GRAPH, return_dtypes=None): def converted_call(f, owner, options, *args, **kwargs): """Compiles a function call inline. For internal use only.""" - if options.verbose >= converter.Verbosity.VERBOSE: - logging.info('Converted call: {}; owner: {}'.format(f, owner)) + logging.vlog(logging.DEBUG, 'Converted call: %s; owner: %s', f, owner) if owner is not None: if not isinstance(f, str): diff --git a/tensorflow/python/autograph/impl/conversion.py b/tensorflow/python/autograph/impl/conversion.py index f8decd24e8e..d0a12df6eb4 100644 --- a/tensorflow/python/autograph/impl/conversion.py +++ b/tensorflow/python/autograph/impl/conversion.py @@ -129,8 +129,7 @@ def entity_to_graph(o, program_ctx, arg_values, arg_types): Raises: ValueError: if the entity type is not supported. """ - if program_ctx.options.verbose == converter.Verbosity.VERBOSE: - logging.info('Converting {}'.format(o)) + logging.vlog(logging.DEBUG, 'Converting %s', o) if tf_inspect.isclass(o): node, name, ns = class_to_graph(o, program_ctx) @@ -164,9 +163,9 @@ def entity_to_graph(o, program_ctx, arg_values, arg_types): program_ctx.add_to_cache(o, node) - if program_ctx.options.verbose == converter.Verbosity.VERBOSE: - logging.info('Compiled output of {}:\n\n{}\n'.format( - o, compiler.ast_to_source(node))) + if logging.get_verbosity() <= logging.DEBUG: + logging.vlog(logging.DEBUG, 'Compiled output of %s:\n\n%s\n', o, + compiler.ast_to_source(node)) if program_ctx.options.recursive: while True: -- GitLab