Skip to content

Instantly share code, notes, and snippets.

@ikr4-m
Created April 8, 2025 08:27
Show Gist options
  • Save ikr4-m/5e9f10d437c3a9b5a87ec4c418c596bf to your computer and use it in GitHub Desktop.
Save ikr4-m/5e9f10d437c3a9b5a87ec4c418c596bf to your computer and use it in GitHub Desktop.
Print Log Using ts (moreutils)
#!/usr/bin/env bash
set -euo pipefail
LOGS=${LOGS:-}
if [ -n "$LOGS" ] && [ ! -d "./logs" ]; then
mkdir -p logs
fi
if [ -n "$LOGS" ]; then
uvicorn app.main:app 2>&1 > /dev/null | ts "[%F %D %z]" >> ./logs/app.log
else
uvicorn app.main:app
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment