function_trace#
- omni.graph.tools.function_trace(env_var=None)#
Debugging decorator that adds function call tracing, potentially gated by an environment variable.
Use as a normal function decorator:
@function_trace() def my_function(value: str) -> str: return value + value
Calling my_function(“X”) with debugging enabled will print this:
- Calling my_function(‘X’)
‘my_function’ returned ‘XX’
The extra parameter lets you selectively disable it based on environment variables:
@function_trace("OGN_DEBUG") def my_function(value: str) -> str: return value + value
This version only enables debugging if the environment variable “OGN_DEBUG” is set