Features:
prefix + alt + c
Tested and working on Linux, OSX and Cygwin.
Toggle (start/stop) logging in the current pane.
prefix + shift + p
tmux-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
$HOME
(user home dir)
~/tmux-my-session-0-1-20140527T165614.log
Save visible text, in the current pane. Equivalent of a "textual screenshot".
prefix + alt + p
tmux-screen-capture-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
$HOME
(user home dir)
tmux-screen-capture-my-session-0-1-20140527T165614.log
Save complete pane history to a file. Convenient if you retroactively remember you need to log/save all the work.
prefix + alt + shift + p
tmux-history-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
$HOME
(user home dir)
tmux-history-my-session-0-1-20140527T165614.log
NOTE: this functionality depends on the value of history-limit
- the number
of lines Tmux keeps in the scrollback buffer. Only what Tmux kept will also be saved,
to a file.
Use set -g history-limit 50000
in .tmux.conf, with modern computers
it is ok to set this option to a high number.
Key binding: prefix + alt + c
This is just a convenience key binding.
Add plugin to the list of TPM plugins in .tmux.conf
:
set -g @plugin 'tmux-plugins/tmux-logging'
Hit prefix + I
to fetch the plugin and source it.
You should now have all tmux-logging
key bindings defined.
Clone the repo:
$ git clone https://github.com/tmux-plugins/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
(recommended for OSX users)If you're on OSX, it is recommended to install ansifilter
:
$ brew install ansifilter
ansifilter is a program specialized for removing (or working with) ANSI codes.
It helps with removing ANSI codes from the log. If ansifilter
is not present,
ANSI codes are removed with sed
.
This feature 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 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 this plugin is used:
You might also find these useful: