Skip to content

Overview ​

consoleIntegration turns every console.log, info, warn, error and debug call into a Buglapse log event of the matching level, so your existing console output shows up on the Logs page without rewriting it to log.*(). The original call still prints to stdout/stderr as usual.

Arguments are mapped the same way log.*() takes them: a trailing plain object becomes the log's attributes, everything before it is joined into the message.

ts
console.warn('Payment retry', 3, { orderId: 'A-1042' })
// → warn log "Payment retry 3" with attributes { orderId: 'A-1042' }

A log captured during a request carries that request's scope and trace, like any other event.

Usage ​

ts
import { use } from '@buglapse/node'
import { consoleIntegration } from '@buglapse/node/integrations'

use(consoleIntegration())

It has no options.

Keep in mind:

  • Every library in the process shares the same console, so everything they print is sent too — and counts toward the log quota.
  • console.error(error) is sent with the message {}, since an Error doesn't survive JSON.stringify. Report errors with captureException().
  • Loggers that write straight to process.stdout (pino, most winston transports) don't go through console and aren't captured.
  • The SDK's own debug output bypasses the patched console, so it's never captured.

If you only want console output as context for errors, use the console option of BreadcrumbsIntegration instead. See Logs for sending logs explicitly.