Skip to main content

API

Logger Functionalities

Logs

logs.ts
logger.log('Log message', { value })
logger.warn('Warning message', { value })
logger.error(new Error('Error message'))
logger.info('Info message', { value })

Slack

  • echo:
    • label: The label for the message.
    • data: Data to be sent in the message.
    • module: The module from which the messages are being sent.
    • options:
      • sendIn: Specifies in which mode the logs should be sent.
      • include: Determines additional data to include in the log.
logs.ts
logger.slack.echo('Label', {
id: uuid.v4(),
email,
}, 'Example', {
include: ['version'],
sendIn: ['debug', 'release']
})

Sentry

  • captureBreadcrumb: Captures and records a breadcrumb (an event log for tracking).
    • type: The event type (error, warning, info, debug).
    • msg: The log message.
    • data: Additional log data.
    • category: Log category (default: logger:{type}).
logs.ts
logger.sentry.captureBreadcrumb('info', 'Message', { value })
  • captureException: Captures and logs an exception.
    • err: The error to be captured.
logs.ts
logger.sentry.captureException(new Error('Error message'))

Performance Monitoring

  • inspectRender: Monitors how many times a component renders per second.
    • name: Component name.
    • options:
      • noHooks: Enables or disables lifecycle logs.
      • throttleInterval: Log interval.
      • maxRenders: Maximum number of renders allowed before triggering a warning.
logs.ts
function Component() {
logger.perf.inspectRender('Component', {
noHooks: false,
throttleInterval: 1000,
maxRenders: 30,
})

return null
}