Add a way to listen to all events with Pool:on
Opened this issue · 4 comments
I think it would be extremely helpful for logging & debugging purposes to add a special event like "all"
or "*"
or nil
to execute function on all events.
possibly!
out of curiosity, would you be able to figure out how to add the logging directly to the library?
I am currently trying to hack something around it via replacing emit
with a custom one that also logs certain events (based on an ignore list) & print the ones with moon.p
.
I am no expert in logging, but I think adding logging directly to the lib would be a bit too much
- log stream - you can't always log to
stdout
/stderr
- filters - you might want to specify some filters to ignore certain events to improve readability, for example
"collision" or "update"
- logging arguments - you need to serialize all kinds of payload to be really useful
I do not know how to implement all those stuff flexible, so I think a way of letting the users tap all events means you can implement whatever way you want to log.
how's your hacking going?
(Had a few hours of sleep before school)
I did this last night:
https://github.com/Sasszem/crossfire/blob/master/src/EventLogger.moon
(Yea, I use moon for my amazing project)