Created
April 8, 2025 08:27
-
-
Save ikr4-m/5e9f10d437c3a9b5a87ec4c418c596bf to your computer and use it in GitHub Desktop.
Print Log Using ts (moreutils)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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