Skip to content
Merged
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,21 @@ The database is stored at `$XDG_DATA_HOME/local-wisper/transcripts.sqlite3`, or
`~/.local/share/local-wisper/transcripts.sqlite3` when `XDG_DATA_HOME` is unset.
Local Wisper restricts the directory to the current user, but the database
contents are not encrypted.

## Error logs

The Sway wrapper appends errors and warnings to
`$XDG_STATE_HOME/local-wisper/sway.log`, defaulting to
`~/.local/state/local-wisper/sway.log`. It records the command, timestamp, and
nonzero exit status. This includes transcription failures, cleanup warnings,
and clipboard or typing failures. Transcript stdout is not added to this log.
Reinstall the wrapper after updating to enable logging.

```bash
tail -n 100 ~/.local/state/local-wisper/sway.log
```

The model daemon also writes to `$XDG_CACHE_HOME/local-wisper/daemon.log`,
defaulting to `~/.cache/local-wisper/daemon.log`.
Direct CLI invocations print errors to stderr. Logs remain on this device and
are not automatically rotated.
17 changes: 16 additions & 1 deletion integrations/sway/local-wisper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ LW_POST_PROCESS_MODEL="${LW_POST_PROCESS_MODEL:-}"
LW_POST_PROCESS_TIMEOUT="${LW_POST_PROCESS_TIMEOUT:-20}"
LW_POST_PROCESS_GLOSSARY_FILE="${LW_POST_PROCESS_GLOSSARY_FILE:-}"

# Sway does not reliably retain stderr from shortcut commands.
LW_LOG_DIR="${XDG_STATE_HOME:-${HOME}/.local/state}/local-wisper"
if (umask 077; mkdir -p "${LW_LOG_DIR}" && touch "${LW_LOG_DIR}/sway.log"); then
exec 2>>"${LW_LOG_DIR}/sway.log"
printf '\n[%s] command=%s pid=%s\n' "$(date -Is)" "${1:-record}" "$$" >&2
else
echo "local wisper: could not open persistent error log" >&2
fi

if [[ -z "${LW_BIN}" ]]; then
if command -v notify-send >/dev/null 2>&1; then
notify-send "local wisper" "'lw' is not in PATH; install it from https://github.com/none23/local-wisper"
Expand Down Expand Up @@ -63,4 +72,10 @@ case "${1:-}" in
;;
esac

exec "${LW_BIN}" "${args[@]}" "$@"
if "${LW_BIN}" "${args[@]}" "$@"; then
exit 0
else
status=$?
printf '[%s] command=%s pid=%s exited=%s\n' "$(date -Is)" "${1:-record}" "$$" "${status}" >&2
exit "${status}"
fi