Revert "fix(shell): disable init logging by default"

This reverts commit e4fcf78b09.
This commit is contained in:
randogoth 2026-02-05 07:28:38 +02:00
parent e4fcf78b09
commit 85b21cc6ea

View file

@ -1,22 +1,7 @@
# ---- logging --------------------------------------------------------------- # ---- logging ---------------------------------------------------------------
log_shell_init() { log_shell_init() {
# Disabled by default to avoid noisy permission errors in login shells. printf '%s\n' "shell-init: $*" >>/tmp/shell-init.log 2>/dev/null || true
# 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
} }
# ---- helpers --------------------------------------------------------------- # ---- helpers ---------------------------------------------------------------
@ -141,4 +126,4 @@ fi
if have bat; then if have bat; then
alias cat='bat --style=plain --pager=never' 2>/dev/null alias cat='bat --style=plain --pager=never' 2>/dev/null
fi fi