1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Script de Logs Android - SevenX Engine
# Monitora logs do aplicativo em tempo real
Write-Host "📱 SevenX Engine - Monitor de Logs Android" -ForegroundColor Cyan
Write-Host "===========================================" -ForegroundColor Cyan
Write-Host ""
# Verifica se adb está disponível
if (!(Get-Command adb -ErrorAction SilentlyContinue)) {
Write-Host "❌ ADB não encontrado!" -ForegroundColor Red
exit 1
}
# Lista dispositivos
$devices = adb devices | Select-String -Pattern "^\w+" | Where-Object { $_ -notmatch "List of devices" }
if ($devices.Count -eq 0) {
Write-Host "❌ Nenhum dispositivo conectado!" -ForegroundColor Red
exit 1
}
# Selecionar dispositivo se houver múltiplos
$deviceId = $null
if ($devices.Count -eq 1) {
$parts = $devices[0].ToString().Split("`t")
$deviceId = $parts[0].Trim()
$model = (adb -s $deviceId shell getprop ro.product.model 2>$null).Trim()
Write-Host "✅ Dispositivo: $model" -ForegroundColor Green
} else {
Write-Host "📱 Dispositivos encontrados:" -ForegroundColor Yellow
Write-Host ""
$deviceList = @()
$index = 1
foreach ($line in $devices) {
$parts = $line.ToString().Split("`t")
if ($parts.Count -ge 2 -and $parts[1].Trim() -eq "device") {
$id = $parts[0].Trim()
$model = (adb -s $id shell getprop ro.product.model 2>$null).Trim()
$deviceList += @{ Index = $index; Id = $id; Model = $model }
Write-Host "$index. $model ($id)" -ForegroundColor White
$index++
}
}
Write-Host ""
$choice = Read-Host "Escolha o dispositivo (1-$($deviceList.Count))"
$choiceNum = [int]$choice
if ($choiceNum -lt 1 -or $choiceNum -gt $deviceList.Count) {
Write-Host "❌ Escolha inválida!" -ForegroundColor Red
exit 1
}
$deviceId = $deviceList[$choiceNum - 1].Id
}
Write-Host ""
Write-Host "===========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "📊 Monitorando logs (Ctrl+C para parar)..." -ForegroundColor Yellow
Write-Host ""
# Limpa logs antigos
adb -s $deviceId logcat -c 2>$null
# Monitora logs com filtros
# Mostra apenas logs relevantes do SevenX Engine
adb -s $deviceId logcat -v time | ForEach-Object {
$line = $_
# Filtros para logs relevantes
if ($line -match "SevenX|RustStdoutStderr|RUST|rust|panic|ERROR|FATAL|AndroidRuntime") {
# Colorir por tipo
if ($line -match "ERROR|FATAL|panic") {
Write-Host $line -ForegroundColor Red
}
elseif ($line -match "WARN|WARNING") {
Write-Host $line -ForegroundColor Yellow
}
elseif ($line -match "SevenX|RUST") {
Write-Host $line -ForegroundColor Cyan
}
elseif ($line -match "DEBUG") {
Write-Host $line -ForegroundColor Gray
}
else {
Write-Host $line -ForegroundColor White
}
}
}