Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
3
Maintainers
1
Versions
247
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @datadog/browser-logs

Send logs to Datadog from web browser pages with the browser logs SDK.


Version published
Weekly downloads
735K
decreased by-10.02%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

v5.0.0

See our upgrade guide for a comprehensive list of breaking changes introduced by this major version.

  • 💥 [RUMF-1589] automatically start recording (#2275)
  • 💥 [RUMF-1587] Remove premiumSampleRate and replaySampleRate (#2256)
  • 💥 [RUMF-1597] Drop plan and send sampled_for_replay (#2293)
  • 💥 [RUMF-1578] Promote track frustration as default action behaviour (#2232)
  • 💥 [RUMF-1230] Only apply main logger configuration to its own logs (#2298)
  • 💥 [RUM-1210] Add W3C tracecontext to default propagator types (#2443)
  • 💥 [RUMF-1473] Ignore untrusted event (#2308)
  • 💥 [RUMF-1564] remove intake subdomains (#2309)
  • 💥 [RUMF-1577] Stop collecting foreground periods (#2311)
  • 💥 [RUMF-1557] beforeSend domain context: use PerformanceEntry (#2300)
  • 💥 [RUMF-1556] Typings: consistent beforeSend return type (#2303)
  • 💥 [RUMF-1229] Logs: remove error.origin attribute (#2294)
  • 💥 [RUMF-1228] Remove console error message prefix (#2289)
  • 💥 [RUMF-1555] Rework logger context APIs (#2285)
  • 💥 [RUMF-1152] sanitize resource method names (#2288)
  • 💥 [RUMF-1555] Remove event in action domain context (#2286)
  • 💥 [RUMF-1588] Update default session replay behaviour (#2257)
  • 💥 [RUMF-1554] Drop some deprecated public APIs (#2241)
  • 💥 [RUMF-1554] Drop some deprecated config parameters (#2238)
  • ✨ [RUM-255] add allowUntrustedEvents config parameter (#2347)
  • 🐛 [RUMF-1499] Don't send duration for resources crossing a page frozen state (#2271)
  • 🔥 [RUMF-1555] Remove startTime in xhr start context (#2287)
  • ♻️ [RUMF-1555] Remove deprecated context manager APIs (#2284)

Readme

Source

Browser Log Collection

Send logs to Datadog from web browser pages with the browser logs SDK.

See the dedicated datadog documentation for more details.

Usage

After adding @datadog/browser-logs to your package.json file, initialize it with:

import { datadogLogs } from '@datadog/browser-logs'

datadogLogs.init({
  clientToken: '<DATADOG_CLIENT_TOKEN>',
  site: '<DATADOG_SITE>',
  forwardErrorsToLogs: true,
  sessionSampleRate: 100,
})

After the Datadog browser logs SDK is initialized, send custom log entries directly to Datadog:

import { datadogLogs } from '@datadog/browser-logs'

datadogLogs.logger.info('Button clicked', { name: 'buttonName', id: 123 })

try {
  ...
  throw new Error('Wrong behavior')
  ...
} catch (ex) {
  datadogLogs.logger.error('Error occurred', { team: 'myTeam' }, ex)
}

FAQs

Last updated on 16 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc