ptyproxy is a simple pty proxy that logs input and output to in.log and out.log. Example: $ ptyproxy emacs -nw