Log all tmux console output.
Go to file
2014-05-27 16:13:27 +02:00
screenshots Re-write readme, rename files 2014-05-27 16:13:27 +02:00
scripts Further DRYing the scrollback & screenoshot func 2014-05-27 14:29:13 +02:00
LICENSE.md Add readme 2014-05-26 14:18:59 +02:00
logging.tmux Re-write readme, rename files 2014-05-27 16:13:27 +02:00
README.md Re-write readme, rename files 2014-05-27 16:13:27 +02:00

Tmux Logging

Features:

  1. Logging of all output in the current pane
    After you start logging, everything that's typed and all the output will be saved to a file.
  2. Enables "screen capture" of the current pane
    All the text visible in the current pane is saved to a file. Like a screenshot, but textual.
  3. Enables saving a complete history of the current pane
    All that has been typed and all the output since the creation of the current pane is saved to a file.

1. Logging

Key binding: prefix + shift + p
Toggles (start/stop) logging in the current pane.

Logging improves the default pipe-pane logging mechanism by stripping ANSI codes.

This is how the plain pipe-pane log output looks like if you're using terminal with coloring:

garbled log output

Garbled characters are called ANSI codes. They enable colors in terminal, but are just making 'noise' in the textual log output.

A user will probably want to filter ANSI codes out of the log. Here's the same log as above when using this plugin:

proper log output

2. "Screen capture"

Key binding: prefix + alt + p
Visible text in the current pane is saved to a file. Equivalent of a "texual screenshot".

File path: $HOME
File name: $HOME

3. Capture complete pane history

Key binding: prefix + alt + shift + p
Saves complete pane scrollback to a file. Convenient if you remember you need the log of all the work retroactively.

NOTE: this functionality depends on the value of history-limit - it determines the number of lines Tmux keeps in the scrollback buffer. Everything that Tmux kept will also be saved to a file.

With modern computers it is safe to set this option to a high number:

# in .tmux.conf
set -g history-limit 50000

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @tpm_plugins "       \
  bruno-/tpm                \
  bruno-/tmux_logging       \
"

Hit prefix + I to fetch the plugin and source it.

You should now have all tmux_logging key bindings defined.

Manual Installation

Clone the repo:

$ git clone https://github.com/bruno-/tmux_logging ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/logging.tmux

Reload TMUX environment:

# type this in terminal
$ tmux source-file ~/.tmux.conf

You should now have all tmux_logging key bindings defined.

ansifilter is a program specialized for removing (or working with) ANSI codes.

If you're on OSX, it is recommened to install ansifilter: $ brew install ansifilter

It helps with removing ANSI codes from the log. If ansifilter is not present, ANSI codes are removed with sed.

Credits

Thanks to Chris Johnsen for providing this answer on stackexchange. This plugin started as an improvement of bindings from that answer.

License

MIT