Revert "fix(shell): disable init logging by default"
This reverts commit e4fcf78b09.
This commit is contained in:
parent
e4fcf78b09
commit
85b21cc6ea
1 changed files with 2 additions and 17 deletions
|
|
@ -1,22 +1,7 @@
|
|||
# ---- logging ---------------------------------------------------------------
|
||||
|
||||
log_shell_init() {
|
||||
# Disabled by default to avoid noisy permission errors in login shells.
|
||||
# Enable with:
|
||||
# export NANUQSAURUS_SHELL_INIT_LOG=1
|
||||
# Optionally override the file path:
|
||||
# export NANUQSAURUS_SHELL_INIT_LOG_FILE="$HOME/.local/state/shell-init.log"
|
||||
[[ -n "${NANUQSAURUS_SHELL_INIT_LOG:-}" ]] || return 0
|
||||
|
||||
local uid="${UID:-}"
|
||||
[[ -n "$uid" ]] || uid="$(id -u 2>/dev/null || echo unknown)"
|
||||
|
||||
local log_file="${NANUQSAURUS_SHELL_INIT_LOG_FILE:-${XDG_STATE_HOME:-$HOME/.local/state}/nanuqsaurus/shell-init-${uid}.log}"
|
||||
local log_dir="${log_file%/*}"
|
||||
|
||||
mkdir -p "$log_dir" 2>/dev/null || return 0
|
||||
# Redirect stderr first so a failing stdout redirection stays silent.
|
||||
printf '%s\n' "shell-init: $*" 2>/dev/null >>"$log_file" || true
|
||||
printf '%s\n' "shell-init: $*" >>/tmp/shell-init.log 2>/dev/null || true
|
||||
}
|
||||
|
||||
# ---- helpers ---------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue