tf.get_logger  |  TensorFlow v2.16.1 (original) (raw)

tf.get_logger

Stay organized with collections Save and categorize content based on your preferences.

Return TF logger instance.

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.get_logger

tf.get_logger()

Used in the notebooks

Used in the guide Used in the tutorials
Migrating your TFLite code to TF2 Customizing MinDiffModel Integrating MinDiff with MinDiffModel Integrating MinDiff without MinDiffModel Subword tokenizers TensorFlow Hub Object Detection Colab Implement Differential Privacy with TensorFlow Privacy Parametrized Quantum Circuits for Reinforcement Learning Object Detection with TensorFlow Lite Model Maker Text classification with TensorFlow Lite Model Maker
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:

  1. FATAL
  2. ERROR
  3. WARN
  4. INFO
  5. DEBUG

The logger has the following methods, based on these logging levels:

  1. fatal(msg, *args, **kwargs)
  2. error(msg, *args, **kwargs)
  3. warn(msg, *args, **kwargs)
  4. info(msg, *args, **kwargs)
  5. debug(msg, *args, **kwargs)

The msg can contain string formatting. An example of logging at the ERRORlevel 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.")

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.