Record all terminal output to file. More information: https://manned.org/script.
typescript
script
script path/to/session.out
script -a path/to/session.out
stderr
script -t 2> path/to/timingfile