You can use script for that. Script can make typescript of terminal sessions, also persistant through establishing and working on ssh sessions. The script command is part of the util-linux-ng package and is available from
ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.