After yesterday’s reading and decoding exploration, here’s some code which will happily play back my daily log files, of which I now have over 4 years worth …
Sample output:
As you can see, this supports scanning entire log files, both plain text and gzipped. In fact, JeeMonLogParser@parseStream
should also work fine with sockets and pipes:
The beauty – again – is total modularity: both the real serial interface module and this log-replay module generate the same events, and can therefore be used interchangeably. As the decoders work independent of either one, there is no dependency (“coupling”) whatsoever between these modules.
Not to worry: from now on I won’t bore you with every new JavaScript / CoffeeScript snippet I come up with – just wanted to illustrate how asynchronous I/O and events are making this code extremely easy to develop and try out in small bites.
I wish you a Guten Rutsch ins neue Jahr and a safe, healthy, and joyful 2013!