summaryrefslogtreecommitdiffstats
path: root/src/init
diff options
context:
space:
mode:
authorTilmann Meyer <allescrafterx@gmail.com>2020-09-28 22:38:50 +0200
committerGitHub <noreply@github.com>2020-09-28 16:38:50 -0400
commit22336834109a1659069acdfb1dfeb324206a9fc9 (patch)
treea3071d855ae1129817e000fb77932c1c5608cd6d /src/init
parent3c668e6e6ac0c0ee7dbe2ef69ede1e4a16ec1c9c (diff)
feat: add error messaging (#1576)
This creates a custom logger for the log crate which logs everything to a file (/tmp/starship/session_$STARSHIP_SESSION_KEY.log) and it logs everything above Warn to stderr, but only if the log file does not contain the line that should be logged resulting in an error or warning to be only logged at the first starship invocation after opening the shell.
Diffstat (limited to 'src/init')
-rw-r--r--src/init/starship.bash3
-rw-r--r--src/init/starship.fish3
-rw-r--r--src/init/starship.ion3
-rw-r--r--src/init/starship.ps13
-rw-r--r--src/init/starship.zsh3
5 files changed, 15 insertions, 0 deletions
diff --git a/src/init/starship.bash b/src/init/starship.bash
index 822a3b0b5..f7bd2d9d0 100644
--- a/src/init/starship.bash
+++ b/src/init/starship.bash
@@ -84,3 +84,6 @@ fi
# Set up the start time and STARSHIP_SHELL, which controls shell-specific sequences
STARSHIP_START_TIME=$(::STARSHIP:: time)
export STARSHIP_SHELL="bash"
+
+# Set up the session key that will be used to store logs
+export STARSHIP_SESSION_KEY=$(::STARSHIP:: session)
diff --git a/src/init/starship.fish b/src/init/starship.fish
index 6daa473d4..8236f548b 100644
--- a/src/init/starship.fish
+++ b/src/init/starship.fish
@@ -16,3 +16,6 @@ set VIRTUAL_ENV_DISABLE_PROMPT 1
function fish_mode_prompt; end
export STARSHIP_SHELL="fish"
+
+# Set up the session key that will be used to store logs
+export STARSHIP_SESSION_KEY=(::STARSHIP:: session)
diff --git a/src/init/starship.ion b/src/init/starship.ion
index 0d979df2d..5a03ab2e1 100644
--- a/src/init/starship.ion
+++ b/src/init/starship.ion
@@ -15,3 +15,6 @@ end
# Export the correct name of the shell
export STARSHIP_SHELL="ion"
+
+# Set up the session key that will be used to store logs
+export STARSHIP_SESSION_KEY=$(::STARSHIP:: session)
diff --git a/src/init/starship.ps1 b/src/init/starship.ps1
index 558d9c5ca..74c8f952f 100644
--- a/src/init/starship.ps1
+++ b/src/init/starship.ps1
@@ -54,3 +54,6 @@ function global:prompt {
}
$ENV:STARSHIP_SHELL = "powershell"
+
+# Set up the session key that will be used to store logs
+$ENV:STARSHIP_SESSION_KEY = $(::STARSHIP:: session)
diff --git a/src/init/starship.zsh b/src/init/starship.zsh
index ed8452de9..5ecb33d12 100644
--- a/src/init/starship.zsh
+++ b/src/init/starship.zsh
@@ -62,3 +62,6 @@ zle-keymap-select() {
STARSHIP_START_TIME=$(::STARSHIP:: time)
zle -N zle-keymap-select
export STARSHIP_SHELL="zsh"
+
+# Set up the session key that will be used to store logs
+export STARSHIP_SESSION_KEY=$(::STARSHIP:: session)