You've already forked dts-scripts
mirror of
https://github.com/Dasharo/dts-scripts.git
synced 2026-03-06 15:01:22 -08:00
15 lines
302 B
Bash
15 lines
302 B
Bash
#!/bin/bash
|
|
|
|
start_logging() {
|
|
local file=$1
|
|
CURRENT_TTY="$(tty)"
|
|
exec 1>> >(tee >(stdbuf -i0 -oL -eL ts "[%T]: " >> "$file")) 2>&1
|
|
}
|
|
|
|
stop_logging() {
|
|
exec &>"$CURRENT_TTY"
|
|
}
|
|
|
|
export PS4="+[\$(date +%T.%3N)]:\${BASH_SOURCE[0]}:\${LINENO[0]}:\${FUNCNAME[0]:-main}: "
|
|
export CURRENT_TTY
|