A keylogger essentially logs the keys that you press.

To implement this, I’m thinking of storing the key strokes into a file buffer.
Every now and then (or upon request), this file would be sent to the client.

It might be a good idea to log the timestamps of when keys were pressed, though that will add file size overhead for each keypress.

The iohook package does exactly what I need to do (It even captures mouse input!).

Done and dusted.