2025-07-17 19:39:02 -05:00
2025-07-17 19:35:58 -05:00
2025-07-17 19:39:02 -05:00
2025-07-17 19:35:58 -05:00
2025-07-17 19:35:58 -05:00
2025-07-17 19:35:58 -05:00
2025-07-17 19:35:58 -05:00

tmux-logger

Log everything in tmux automatically. Sessions get random names, all activity is captured. Supports optional timestamps.

Quick Setup

Add to ~/.tmux.conf:

run-shell '/path/to/tmux-logger/tmux-logger.tmux'

Reload tmux:

tmux source-file ~/.tmux.conf

That's it. New sessions get names like PHOENIX or DRAGON, and everything is logged to ~/.tmux-logger/.

What it does

  • Random session names: No more boring numbered sessions
  • Automatic logging: Every pane, window, and session is logged using tmux's built-in pipe-pane
  • Smart filenames: DRAGON_w0-mywindow_p1_20250717.log includes window names when set
  • Silent operation: Works in the background, no interruptions

Manual control

./scripts/control.sh status    # See what's being logged
./scripts/control.sh logs      # List recent log files  
./scripts/control.sh cleanup   # Delete old logs
./scripts/control.sh stop      # Stop logging current pane
./scripts/control.sh start     # Start logging current pane
./scripts/control.sh merge     # Merge logs after window rename

Configuration

# Change log directory (default: ~/.tmux-logger)
set -g @tmux-logger-log-dir "~/my-logs"

# Use custom word list for session names (default: /usr/share/dict/words)
set -g @tmux-logger-word-source "/path/to/words.txt"

# Enable timestamp prefix for each log line (default: off)
set -g @tmux-logger-timestamp-prefix "on"

Timestamp Prefix

When enabled, each line in the log files will be prefixed with a timestamp:

Without timestamps (default):

$ ls -la
total 8
drwxr-xr-x 2 user user 4096 Jan 17 10:30 .

With timestamps enabled:

2025-01-17 10:30:15 $ ls -la
2025-01-17 10:30:15 total 8
2025-01-17 10:30:15 drwxr-xr-x 2 user user 4096 Jan 17 10:30 .

This is useful for tracking exact timing of commands and outputs, but will increase log file sizes.

How it works

Sets up tmux hooks to automatically start pipe-pane logging when you create sessions, windows, or split panes. Session renaming happens first so log files use the proper names.

Window renaming: When you rename a window (Ctrl-b ,), logs automatically transition to new filenames and merge with previous logs for continuity. The plugin disables automatic renaming for manually renamed windows to preserve your custom names.

Session consistency: All panes and windows within the same session use the same session name in log files, ensuring organized logging without naming conflicts.

Requirements

  • tmux 2.0+
  • /usr/share/dict/words (or install words package)
  • Basic Unix tools

Simple and effective.

Description
No description provided
Readme 35 KiB
Languages
Shell 100%