diff --git a/CHANGELOG.md b/CHANGELOG.md index d9324c5..7322f9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ device it points to. - Right-click (or Shift+F10 / Menu key) on the microphone and headphones buttons opens an input / output device menu sharing the Settings selection; left click still mutes/deafens. -- Voice diagnostics in the local log: capture device and track state, push-to-talk presses with window - focus, transmission bursts with frame count and peak level; a warning when two seconds of transmitted - audio are silent. The push-to-talk hint says when the window is not focused (the key is read only there). +- Voice diagnostics: the local log records the capture device and track state; with + `TEAMSPEACH_LOG=debug` it also records push-to-talk presses with window focus and each transmission burst + (frames, peak level). A warning appears when two seconds of transmitted audio are silent. The push-to-talk hint says when the window is not focused (the key is read only there). - Core: identities whose private scalar starts with a zero byte are read correctly (≈0.4 % of new identities were rejected after restart). diff --git a/app/main/main.js b/app/main/main.js index c3ac8c1..9c0ace0 100644 --- a/app/main/main.js +++ b/app/main/main.js @@ -21,6 +21,8 @@ const { RENDERER_DIR, resolveCoreBinary, dataDir, logsDir, prefsFile } = require const { CoreProcess } = require('./core-process'); const { validateRequest } = require('./ipc-validate'); const { permissionCheckAllowed, permissionRequestAllowed } = require('./permissions'); +// Same switch the core uses for its own verbosity (see docs/bridge.md). +const RENDERER_DEBUG_LOG = /\b(debug|trace)\b/.test(process.env.TEAMSPEACH_LOG ?? ''); const { Prefs } = require('./prefs'); const APP_SCHEME = 'app'; @@ -498,6 +500,8 @@ function registerIpc() { if (now - rendererLogBudget.windowStart > 1000) rendererLogBudget = { windowStart: now, count: 0 }; if (++rendererLogBudget.count > 40) return; const lvl = ['debug', 'info', 'warn', 'error'].includes(level) ? level : 'info'; + // Per-burst voice diagnostics are debug level: written only when started with TEAMSPEACH_LOG=debug|trace. + if (lvl === 'debug' && !RENDERER_DEBUG_LOG) return; if (!rendererLog) { fs.mkdirSync(logsDir(), { recursive: true }); rendererLog = fs.createWriteStream(path.join(logsDir(), 'renderer.log'), { flags: 'a' }); diff --git a/app/renderer/js/voice.js b/app/renderer/js/voice.js index 7e38fd5..319a30a 100644 --- a/app/renderer/js/voice.js +++ b/app/renderer/js/voice.js @@ -98,7 +98,7 @@ function onFrame(pcm, rms, peak) { sending = true; voiceStats.bursts += 1; burst = { frames: 0, peakMax: 0, warned: false, mode: S.prefs.transmitMode }; - log('info', `voice: burst start mode=${burst.mode} focused=${document.hasFocus()} capture=${engine.capturing}`); + log('debug', `voice: burst start mode=${burst.mode} focused=${document.hasFocus()} capture=${engine.capturing}`); hooks.onTransmitChanged(); } burst.frames += 1; @@ -112,7 +112,7 @@ function onFrame(pcm, rms, peak) { } else if (sending) { tp.endAudio(); sending = false; - log('info', `voice: burst end frames=${burst.frames} peak=${burst.peakMax > 0 ? (20 * Math.log10(burst.peakMax)).toFixed(1) : '-inf'} dBFS`); + log('debug', `voice: burst end frames=${burst.frames} peak=${burst.peakMax > 0 ? (20 * Math.log10(burst.peakMax)).toFixed(1) : '-inf'} dBFS`); burst = null; hooks.onTransmitChanged(); } @@ -269,7 +269,7 @@ export function setPtt(down, source = 'key') { const btn = $('#btn-ptt'); btn.setAttribute('aria-pressed', String(down)); setText(btn, down ? 'Говорите…' : 'Удерживайте, чтобы говорить'); - if (S.prefs?.transmitMode === 'ptt') log('info', `voice: ptt ${down ? 'down' : 'up'} source=${source} focused=${document.hasFocus()}`); + if (S.prefs?.transmitMode === 'ptt') log('debug', `voice: ptt ${down ? 'down' : 'up'} source=${source} focused=${document.hasFocus()}`); hooks.onPtt(down); }