Integrating USD Tf.Warn with Python logging.Logger

Hi everyone,

I’m trying to route USD’s Tf.Warn messages to Python’s logging.Logger in our project but haven’t had success with Tf.Notice listeners or redirecting stderr. Does anyone have experience or tips on how to capture these warnings directly into a Python logger? Any advice or examples would be greatly appreciated!

Thanks!

Nick

You may find a custom TfDiagnosticDelegate useful. Here is one that we provide as part of OpenUSD for DCC’s to use, should they want to (we hope to use it in usdview someday).

Just keep in mind that a process can currently only have one Delegate installed and active, so it is possible, in some USD-using contexts you do not fully control, that you could find yourself fighting the app.

1 Like