The sniffy project can trace/log the data of any pseudo terminal in the system. Due to the way the terminal works, such a terminal trace provides complete information of what happened on the terminal screen, and sniffy is able to display/replay this information. It consists of a kernel module able to connect/hook on the pseudo terminal, a program to display the contents of any pseudo terminal on the fly, a daemon process tracing the pseudo terminal content into the file, and a replay program to replay any stored pseudo terminal session.
Libptytty is a small library that offers pseudo-TTY management in an OS-independent way. It was created out of frustration over the many differences of PTY/TTY handling in different operating systems for use inside "rxvt-unicode". It also offers session database support (utmp and optional wtmp/lastlog updates for login shells) and supports forking a proxy process after startup and dropping privileges in the calling process. It offers C++ and C-only APIs.