schollii / pypubsub

A Python publish-subcribe library (moved here from SourceForge.net where I had it for many years)
189 stars 29 forks source link

How to view Handled messages #45

Open paddymccrudden opened 4 years ago

paddymccrudden commented 4 years ago

Hi,

I am in the process of debugging and application that uses PyPubSub for its messages. I am using the snoop methods (https://pypubsub.readthedocs.io/en/v4.0.3/usage/usage_advanced_debug.html#id4) to see which messages are published. However, I'd really like to also log whenever a handler receives a message. Is there a means of doing so easily?

Paddy

schollii commented 3 years ago

Have you looked at the notification handlers? They will notify on various pubsub related activities like message publish, message received by which listener, topic created/deleted, etc.

paddymccrudden commented 3 years ago

Thanks - I ended up enforcing some structure on my listeners to log the events. It worked well. I did this as I couldn't see how the notification handlers managed listeners. Do you have a link on that?

schollii commented 3 years ago

Yes have a look at

The notifySend() method of your custom handler gets called several times for each listener.