logger¶
- tripy.logger¶
The global logger used across Tripy.
The verbosity can be controlled using the
verbosity
property and may be either a single string or set of strings:Example: Setting Logging Verbosity
1tp.logger.verbose("This will NOT be logged") 2tp.logger.verbosity = "verbose" 3tp.logger.verbose("This will be logged")
[V] This will be logged
Possible values for this come from the keys of
logger.VERBOSITY_CONFIGS
.It may alternatively be provided in a per-path dictionary to set per-module/submodule verbosities:
Example: Per-Submodule Logging Verbosities
1# Enable `verbose` logging for just the frontend module: 2tp.logger.verbosity = {"frontend": "verbose"} 3 4# Enable `verbose` and `timing` logging for just the frontend module: 5tp.logger.verbosity = {"frontend": {"verbose", "timing"}}
Verbosity can also be changed temporarily by using the
use_verbosity
context manager:Example: Setting Logging Verbosity Temporarily
1tp.logger.verbose("This will NOT be logged") 2 3with tp.logger.use_verbosity("verbose"): 4 tp.logger.verbose("This will be logged") 5 6tp.logger.verbose("This will NOT be logged")
[V] This will be logged