Flare by Spatie
    • Error Tracking
    • Performance Monitoring
    • Logs
  • Pricing
  • Docs
  • Blog
  • Changelog
  • Back to Flare ⌘↵ Shortcut: Command or Control Enter
  • Sign in
  • Try Flare for free
  • Error Tracking
  • Performance Monitoring
  • Logs
  • Pricing
  • Docs
  • Blog
  • Changelog
    • Back to Flare ⌘↵ Shortcut: Command or Control Enter
    • Try Flare for free
    • Sign in
Flare Flare PHP PHP JavaScript JavaScript Protocol Protocol
JavaScript
  • JavaScript
  • React
  • Vue
  • Svelte
  • Inertia
  • React Native
  • Electron
  • Getting Started
  • Introduction
  • Quick start
  • CDN installation
  • Errors
  • Reporting errors
  • Client hooks
  • Sourcemaps
  • Tracing
  • How tracing works
  • What gets traced
  • Web vitals
  • Manual spans
  • Sampling
  • Profiling
  • How component profiling works
  • Logs
  • Introduction
  • Levels
  • Attributes
  • Data Collection
  • Adding custom context
  • Adding glows
  • Automatic breadcrumbs
  • GDPR consent
  • Identifying users
  • Reference
  • API
  • Configuration

Attributes

View as Markdown

Every log method accepts an optional second argument: an object of structured attributes attached to that single log entry. Use it to record the data that makes a log message useful to search and filter on later.

flare.logger.info('Order placed', {
    orderId: 'ord_8231',
    total: 49.99,
    currency: 'EUR',
    items: 3,
});

Attribute values can be strings, numbers, booleans, null, arrays, or nested objects:

flare.logger.warning('Validation failed', {
    field: 'email',
    errors: ['required', 'invalid_format'],
    context: { formId: 'signup', step: 2 },
});

How attributes are handled

Attributes are frozen at the moment you record the log. The client encodes them immediately, so later changes to the original object don't affect the buffered entry. Pass the values you want captured at call time.

Attributes you set on a log entry apply only to that entry. They are not shared with other logs or with error reports.

Service-wide identity

Set serviceName once through configuration to attach it to every log batch (sent as service.name), rather than passing it per-call:

flare.configure({
    enableLogs: true,
    serviceName: 'storefront',
});
Levels Adding custom context

On this page

  • How attributes are handled
  • Service-wide identity

Catch errors and fix slowdowns with Flare, the full-stack application monitoring platform for Laravel, PHP & JavaScript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Blog
  • Newsletter
  • Changelog
  • Documentation
  • Affiliate program
  • uptime status badge Service status
  • Terms of use
  • DPA
  • Privacy & cookie Policy
Made in by Spatie logo
Flare