Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions scripts/start_logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# path to log file - global variable
FILE="$1"
# LOG FILTER
LOGGING_FILTER="$2"

ansifilter_installed() {
type ansifilter >/dev/null 2>&1 || return 1
Expand All @@ -27,15 +29,34 @@ pipe_pane_sed() {
tmux pipe-pane "exec cat - | sed -r 's/$ansi_codes//g' >> $FILE"
}

pipe_pane_no_filter() {
tmux pipe-pane "exec cat >> $FILE"
}

start_pipe_pane() {
if ansifilter_installed; then
pipe_pane_ansifilter
elif system_osx; then
# OSX uses sed '-E' flag and a slightly different regex
pipe_pane_sed_osx
else
pipe_pane_sed
fi
case "$LOGGING_FILTER" in
auto)
if ansifilter_installed; then
pipe_pane_ansifilter
elif system_osx; then
# OSX uses sed '-E' flag and a slightly different regex
pipe_pane_sed_osx
else
pipe_pane_sed
fi
;;
ansifilter)
pipe_pane_ansifilter
;;
sed_osx)
pipe_pane_sed_osx
;;
sed)
pipe_pane_sed
;;
*)
pipe_pane_no_filter
esac
}

main() {
Expand Down
2 changes: 1 addition & 1 deletion scripts/toggle_logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source "$CURRENT_DIR/shared.sh"

start_pipe_pane() {
local file=$(expand_tmux_format_path "${logging_full_filename}")
"$CURRENT_DIR/start_logging.sh" "${file}"
"$CURRENT_DIR/start_logging.sh" "${file}" "${logging_filter}"
display_message "Started logging to ${logging_full_filename}"
}

Expand Down
4 changes: 4 additions & 0 deletions scripts/variables.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ save_complete_history_filename=$(tmux show-option -gqv "@save-complete-history-f
save_complete_history_filename=${save_complete_history_filename:-$default_save_complete_history_filename}

save_complete_history_full_filename="${save_complete_history_path}/${save_complete_history_filename}"

default_logging_filter="auto"
logging_filter=$(tmux show-option -gqv "@logging_filter")
logging_filter=${logging_filter:-$default_logging_filter}