nata icon indicating copy to clipboard operation
nata copied to clipboard

Add a way to listen to all events with Pool:on

Open Sasszem opened this issue 5 years ago • 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.

Sasszem avatar Mar 23 '20 23:03 Sasszem

possibly!

out of curiosity, would you be able to figure out how to add the logging directly to the library?

tesselode avatar Mar 23 '20 23:03 tesselode

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.

Sasszem avatar Mar 23 '20 23:03 Sasszem

how's your hacking going?

tesselode avatar Mar 24 '20 01:03 tesselode

(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)

Sasszem avatar Mar 24 '20 07:03 Sasszem