Return TF logger instance.
tf.get_logger()
| Used in the guide | Used in the tutorials |
|---|---|
| Returns | |
|---|---|
| An instance of the Python logging library Logger. |
See Python documentation (https://docs.python.org/3/library/logging.html) for detailed API. Below is only a summary.
The logger has 5 levels of logging from the most serious to the least:
The logger has the following methods, based on these logging levels:
The msg can contain string formatting. An example of logging at the ERROR level using string formating is:
tf.get_logger().error("The value %d is invalid.", 3)You can also specify the logging verbosity. In this case, the WARN level log will not be emitted:
tf.get_logger().setLevel(ERROR)
tf.get_logger().warn("This is a warning.")
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/get_logger