A useful Powershell script for miners. Run "notepad worldcoin-log-monitor.ps1" and then ".\worldcoin-log-monitor.ps1".
$dataDir = Join-Path $env:APPDATA 'Worldcoin'
# Check if directory exists
if (!(Test-Path $dataDir)) {
Write-Host -ForegroundColor Red 'Error: Directory not found!'
Write-Host -ForegroundColor Yellow 'Please edit this script and verify the folder name in the dataDir variable.'
Write-Host ''
Write-Host "Looked for: $dataDir"
pause
exit
}
Write-Host -ForegroundColor Cyan "Navigating to $dataDir"
Set-Location $dataDir
# notepad worldcoin-log-monitor.ps1
# .\worldcoin-log-monitor.ps1
# Update timestamps of all top-level files
$newTimestamp = Get-Date
Write-Host -ForegroundColor Cyan "Updating timestamps of top-level files to $newTimestamp..."
Get-ChildItem -Path $dataDir -File | ForEach-Object { $_.LastWriteTime = $newTimestamp }
# Handle debug.log file
$logFile = Join-Path $dataDir 'debug.log'
if (Test-Path $logFile) {
Write-Host -ForegroundColor Cyan "Clearing existing debug.log..."
Clear-Content -Path $logFile
} else {
Write-Host -ForegroundColor Yellow 'Warning: debug.log not found. A new file will be monitored if the application creates it.'
}
# Display initial status and start continuous monitoring
Write-Host -ForegroundColor Green ''
Write-Host -ForegroundColor Green 'File preparation completed successfully.'
Write-Host -ForegroundColor Green 'Starting live tail of debug.log...'
Write-Host -ForegroundColor Green 'All new blockchain information will appear below.'
Write-Host -ForegroundColor Yellow 'Press Ctrl+C to stop monitoring.'
Write-Host -ForegroundColor Cyan '--------------------------------------------------'
Write-Host ''
# Start continuous tail with -Wait (this will run indefinitely)
try {
Get-Content -Path $logFile -Tail 0 -Wait
} catch {
Write-Host -ForegroundColor Red "Error monitoring log file: $_"
Write-Host -ForegroundColor Yellow 'The application may need to create the debug.log file first.'
Write-Host -ForegroundColor Yellow 'Waiting for log file to be created...'
# Wait for file to be created, then start monitoring
while (!(Test-Path $logFile)) {
Start-Sleep -Seconds 1
}
Write-Host -ForegroundColor Green 'Log file detected! Starting monitoring...'
Get-Content -Path $logFile -Tail 0 -Wait
}