Log Sistem
Log realtime full-page semua operasi OtoSwitch — scan, auto-switch, change detection, error.
Gambar 1 — Tab Log Sistem.
Sumber data
Log dikirim via Server-Sent Events (SSE) dari endpoint /api/logs. Browser menerima stream langsung tanpa polling.
Persisten log juga ditulis ke file logs/digiflazz.log di server (bisa diakses ops/admin).
Level log
| Level | Warna | Kapan |
|---|---|---|
| DEBUG | Abu-abu | Detail teknis (request payload, internal state). |
| INFO | Biru | Aksi normal (scan dimulai, produk di-update). |
| WARN | Kuning | Anomali yang tidak fatal (rate limit hampir penuh, supplier diabaikan). |
| ERROR | Merah | Operasi gagal (request 5xx, sesi expired, exception). |
Kontrol
- Filter level — toggle DEBUG/INFO/WARN/ERROR.
- Cari — teks bebas (cari pesan tertentu).
- Auto-scroll — toggle. Saat ON, log baru auto-scroll ke bawah. Matikan untuk scroll manual.
- Clear — bersihkan tampilan (tidak hapus file).
- Pause / Resume — pause stream tanpa kehilangan koneksi.
Membaca log umum
Scan dimulai
[INFO] [scan] Starting scan for category KWy9W4 (Pulsa)
[INFO] [scan] Fetched 234 products in 1.2s
[INFO] [scan] Found 5 problematic products: 2 NO_SELLER, 3 PRICE_EXCEEDS_MAX
Auto-switch
[INFO] [switch] Resolving NO_SELLER for SKU AXIS5K
[INFO] [switch] Top candidate: Supplier-X (score 87.5, IP, H+0)
[INFO] [switch] Switched AXIS5K → Supplier-X
Sesi expired
[WARN] [auth] Session expired. Trying re-login (attempt 1/2)
[ERROR] [auth] Re-login failed: 401 Unauthorized
[ERROR] [scan] Aborting cycle — auth failure
Rate limit
[WARN] [api] Rate limit remaining: 8/100. Pausing 5s.
Tips
- Bug report — kalau ada masalah, copy log 30 detik sebelum + setelah masalah, attach saat lapor.
- DEBUG terlalu berisik — matikan filter DEBUG. Aktifkan hanya saat diagnosa.
- Log lengkap — buka file
logs/digiflazz.logdi server untuk riwayat panjang. UI hanya hold sekitar 1000 baris.
FAQ
Log hilang setelah refresh halaman? Ya. Log di UI hanya menampilkan stream live. Riwayat lengkap di file server.
Bisa download log?
Belum di UI. Akses file langsung di server: logs/digiflazz.log.
Apakah aman log berisi info sensitif?
Cookies di-mask di output log (...***...). Password tidak pernah masuk ke log. Tapi ID produk, harga, dan nama supplier tetap muncul.