warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.28k stars 371 forks source link

Add an option to log all inputs and outputs to timestamped per-tab / per-session files. #4833

Open seantcanavan opened 6 months ago

seantcanavan commented 6 months ago

Describe the solution you'd like?

It would be awesome if warp could output all inputs and outputs per tab / session to a timestamped file. maybe even with the tab index as well?

Is your feature request related to a problem? Please describe.

I was doing a lot of infra / docker debugging on my local and while the solution was eventually committed to github, the root cause wasn't always obvious when debugging complex systems.

There were multiple times in the last week where I really wish Warp could write all inputs and all outputs per-tab / per-session to a uniquely named file that way I could go back in time and search for error messages I ended up fixing.

.zhistory is basically one quarter of this new feature request but isn't unique per session and is only the inputs.

Additional context

chatGPT spit out an interesting attempt at using script to achieve this functionality:

function start_logging_session() {
    if [[ -z "$SCRIPT_LOGGING_STARTED" ]]; then
        export SCRIPT_LOGGING_STARTED=1
        local log_dir="$HOME/terminal_logs"
        mkdir -p "$log_dir"
        local log_file="${log_dir}/session_$(date +%Y%m%d_%H%M%S)_$$.txt"
        script "$log_file"
    fi
}

but this has its own problems. for instance, without the export line you create an infinite loop of infinite shells and also infinite log outputs. and then you very quickly cascade disk space as you're running up to hundreds/thousands of shells and writing every terminal command to all of them. i accidentally used about 300MB of disk space in just a few seconds of terminal use.

finally, if you cat one of the hundreds of output files you create another kind of infinite loop where you're essentially cat'ing a file that's being written to in real time and depending on disk i/o it could go on forever as the cat output gets written right back to the file you're cat'ing.

How important is this feature to you?

3

Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1

None

dannyneira commented 6 months ago

Thanks for this feature request!

To anyone else interested in this feature, please add a 👍 to the original post at the top to signal that you want this feature, and subscribe if you'd like to be notified.