summaryrefslogtreecommitdiffstats
path: root/dmt
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-11-09 20:17:25 -0500
committerMalfurious <m@lfurio.us>2023-11-15 23:11:08 -0500
commit29ebd30ecc38bc700a89fc5af58b60637ad3ab3a (patch)
treefb4bf2f44a9ecb507e6d6bf5abf02e6cf5435387 /dmt
parentbc9a915a2709fe7c50f826183ce4d2f6b1816052 (diff)
downloadcychedelic-29ebd30ecc38bc700a89fc5af58b60637ad3ab3a.tar.gz
cychedelic-29ebd30ecc38bc700a89fc5af58b60637ad3ab3a.zip
dmt: Implement API endpoint /api/log/{jobnum}
This returns a plain-text response (not JSON) of the full log file for the requested job number. If `jobnum` is omited, the log of the latest job is returned. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'dmt')
-rwxr-xr-xdmt/dmt12
1 files changed, 11 insertions, 1 deletions
diff --git a/dmt/dmt b/dmt/dmt
index 7923580..ca44b78 100755
--- a/dmt/dmt
+++ b/dmt/dmt
@@ -65,4 +65,14 @@ api_job() {
fi
}
-api_job
+api_log() {
+ [ -z "$1" ] && job="$(newest_job)" || job="$1"
+ jobdir="$CYCHE_LOG_DIR/$job"
+
+ if [ -d "$jobdir" ]; then
+ printf 'Content-type: text/plain\n\n'
+ cat "$jobdir/log"
+ fi
+}
+
+api_log