#!/bin/bash

# Replace verbose console.log with log.debug for debugging statements
sed -i.bak '
s/console\.log(`✅ Found .* connected devices`)/log.debug(`✅ Found .* connected devices`)/g
s/console\.log(`Device details:/log.debug(`Device details:/g
s/console\.log(`iOS USB:/log.debug(`iOS USB:/g
s/console\.log(`Android USB:/log.debug(`Android USB:/g
s/console\.log(`.*EXECUTE.*START`)/log.debug(`&`)/g
s/console\.log(`.*EXECUTION COMPLETE`)/log.debug(`&`)/g
s/console\.log(`Waiting for .* device execution/log.debug(`Waiting for .* device execution/g
s/console\.log(`\[.*\] Creating execution promise/log.debug(`[${deviceName}] Creating execution promise/g
s/console\.log(`.*ExecuteCommand summary:/log.info(`ExecuteCommand summary:/g
s/console\.log(`Calling executeCommand/log.debug(`Calling executeCommand/g
s/console\.log(`executeCommand completed/log.debug(`executeCommand completed/g
' server.js

echo "Fixed logging in server.js"
