Raven ScottandCursor 1f5fbbf623 feat: IPC_QUIET_TYPES and isQuietIpcType for high-frequency dispatch
Export helpers so the worker can skip per-dispatch timing spans for
voice-capture-chunk and display-capture-frame.

Co-authored-by: Cursor <[email protected]>
2026-05-23 04:31:45 -04:00

pearcord-log

Structured logging for Pearcord on Bare/Pear — no central servers, local file + console + optional UI sink.

Features

  • Levels: trace · debug · info · warn · error · fatal
  • Scopes: createLogger('platform').child('guild')[platform:guild]
  • Timings: const span = log.time('loadGuild', { guildId }); span.end()
  • Errors: serializeError(err) with stack, code, and cause
  • Sinks: pretty stderr (default), append-only pearcord.log under storage, configure({ onLine }) for IPC/UI

Usage

const { createLogger, configure, logFilePath } = require('pearcord-log')

configure({
  minLevel: 'debug',
  filePath: logFilePath('/path/to/storage'),
  onLine (record) { /* forward warn+ to UI */ }
})

const log = createLogger('platform')
log.info('ready', { guilds: 3 })

const span = log.time('loadGuild', { guildId: 'abc' })
try {
  await loadGuild('abc')
  span.end()
} catch (err) {
  span.fail(err)
  throw err
}

Quiet IPC

High-frequency UI→worker messages (voice-capture-chunk, display-capture-frame) should not emit per-dispatch timing spans:

const { isQuietIpcType } = require('pearcord-log')
if (!isQuietIpcType(msg.type)) {
  const span = ipcLog.time('dispatch', { type: msg.type })
  // ...
  span.end()
}

Environment

Variable Effect
PEARCORD_LOG_LEVEL Minimum level (debug, info, …)
PEARCORD_LOG_JSON 1 → JSON lines instead of pretty console

Integration

Package Logger scope
pearcord-platform platform
apps/pearcord worker worker
pearcord-ui-flow ui-flow
Companion companion

Log file: <storagePath>/pearcord.log (rotates manually; truncate on boot optional).

S
Description
Pearcord module: structured logging, spans, pearcord.log
Readme
596 KiB
Languages
JavaScript 100%