1f5fbbf6236f346c2724f6e8d752a38d9b4efc80
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]>
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, andcause - Sinks: pretty stderr (default), append-only
pearcord.logunder 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).
Languages
JavaScript
100%