Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging of events that flow through event bus. #8

Closed
Unisay opened this issue Sep 16, 2013 · 3 comments
Closed

Add logging of events that flow through event bus. #8

Unisay opened this issue Sep 16, 2013 · 3 comments

Comments

@Unisay
Copy link

Unisay commented Sep 16, 2013

Its not a bug but rather a feature request:
Event bus makes it harder to debug program. Having ability to switch logging on would greatly simplify life. It would be really nice to see events in the log as they are fired and consumed.

@marcojakob
Copy link
Owner

You could create a subclass of SimpleEventBus and override the fire(...) and on(...) methods. In both methods make a call to super and do the logging. Then instead of creating an instance of SimpleEventBus or calling the factory constructor in EventBus (which also creates a SimpleEventBus), create an instance of your new logging event bus.

Let me know if it works.

@marcojakob
Copy link
Owner

I've added a class LoggingEventBus and an additional name attribute to EventType for logging.

If you instantiate LoggingEventBus and provide the additional name to your EventTypes the events are all logged (see also the example).

@Unisay
Copy link
Author

Unisay commented Sep 16, 2013

Thank you Marco!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants