logs are sent to stderr

This commit is contained in:
GitBluub
2023-04-02 02:09:42 +09:00
committed by Bluub
parent e8f1a34372
commit 73695e2580
4 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ def send(o):
print(json.dumps(o), flush=True) print(json.dumps(o), flush=True)
def log(level, message): def log(level, message):
send({"type": "log", "level": level, "message": message}) o = {"type": "log", "level": level, "message": message}
print(json.dumps(o), flush=True, file=sys.stderr)
def debug(message): def debug(message):
log("DEBUG", message) log("DEBUG", message)
+1 -1
View File
@@ -7,4 +7,4 @@
{"id": 8, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 8, "timingScore": "perfect", "timingInformation": "perfect"}
{"id": 9, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 9, "timingScore": "perfect", "timingInformation": "perfect"}
{"id": 10, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 10, "timingScore": "perfect", "timingInformation": "perfect"}
{"overallScore": 900, "score": {}} {"overallScore": 850, "score": {}}
+1 -1
View File
@@ -6,4 +6,4 @@
{"id": 8, "timingScore": "good", "timingInformation": "late"} {"id": 8, "timingScore": "good", "timingInformation": "late"}
{"id": 9, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 9, "timingScore": "perfect", "timingInformation": "perfect"}
{"id": 10, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 10, "timingScore": "perfect", "timingInformation": "perfect"}
{"overallScore": 750, "score": {}} {"overallScore": 650, "score": {}}
+2 -2
View File
@@ -10,7 +10,7 @@ TESTS_SUCCESS=0
TESTS_FAILED=0 TESTS_FAILED=0
function test { function test {
cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py | grep -v '"type": "log"' &> /tmp/scorometer_res cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /dev/null
TESTS_DONE=$((TESTS_DONE + 1)) TESTS_DONE=$((TESTS_DONE + 1))
if ! diff $1/output /tmp/scorometer_res &>/dev/null; then if ! diff $1/output /tmp/scorometer_res &>/dev/null; then
echo "$t failed, do runner.sh $t for more info" echo "$t failed, do runner.sh $t for more info"
@@ -27,7 +27,7 @@ then
done done
exit $TESTS_FAILED exit $TESTS_FAILED
else else
cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py | grep -v '"type": "log"' &> /tmp/scorometer_res cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /dev/null
echo "=========== CURRENT OUTPUT ===========" echo "=========== CURRENT OUTPUT ==========="
cat /tmp/scorometer_res cat /tmp/scorometer_res
echo "======================================" echo "======================================"