Catch Warning message

How can I catch a warning message, for example:
/usr/local/lib/python3.8/dist-packages/obspy/core/inventory/ UserWarning: More than one PolesZerosResponseStage encountered. Returning first one found.

I would actually like to overload the message with trace info such as station name.

Thank you

Maybe the answer here is working for you:

The problem is that I would like the code to be able to continue after the warning (and as it already does). I just need to overload the message with more info.

I see, then what about this one:

Yes, it worked! Thank you :slight_smile: