feat: add a subcommand for retrieving failed app deploy logs
This can be useful in cases where a developer wishes to see what error messages are available for a failed deploy, but does not wish to spelunk around `docker ps -a` output. Note that the logs are not made available once a further deploy is triggered, or after the containers have been garbage collected.
This commit is contained in:
38
plugins/logs/internal-functions
Executable file
38
plugins/logs/internal-functions
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
fn-logs-usage() {
|
||||
declare desc="logs specific usage"
|
||||
echo "Usage: dokku logs <app>"
|
||||
echo " display recent log output"
|
||||
echo ""
|
||||
echo " -n, --num NUM # the number of lines to display"
|
||||
echo " -p, --ps PS # only display logs from the given process"
|
||||
echo " -t, --tail # continually stream logs"
|
||||
echo " -q, --quiet # display raw logs without colors, time and names"
|
||||
}
|
||||
|
||||
fn-logs-help-content() {
|
||||
declare desc="return logs plugin help content"
|
||||
cat<<help_content
|
||||
logs <app> [-h] [-t] [-n num] [-q] [-p process], Display recent log output
|
||||
logs:failed <app>, Show the last logs for an application
|
||||
help_content
|
||||
}
|
||||
|
||||
cmd-logs-help() {
|
||||
if [[ $1 = "logs:help" ]] ; then
|
||||
echo -e 'Usage: dokku logs[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Output app logs'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
fn-logs-help-content | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
fn-logs-help-content
|
||||
else
|
||||
cat<<help_desc
|
||||
logs, Output app logs
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user