datadog_flutter 0.0.1 copy "datadog_flutter: ^0.0.1" to clipboard
datadog_flutter: ^0.0.1 copied to clipboard

outdated

Log to Datadog from Flutter.

Pub

Datadog Flutter #

Community implementation of native bindings for Datadog's SDK. This is not an official package.

Setup #

  1. Generate a client token from Datadog through the Settings > API panel (under Client Tokens).
  2. Initialize:
      ddLogger = DatadogFlutter(
        clientToken: myDatadogClientToken,
        serviceName: 'my-app-name',
        environment: 'production',
      )
    

In its default implementation, log data will only be transmitted to Datadog through Logger records. print statements are not guaranteed to be captured.

It is strongly recommended to include access DatadogFlutter through a singleton instead of multiple instantiations.

⚠️ Your Podfile must have use_frameworks! (Flutter includes this by default) and your minimum iOS target must be >= 11. This is a requirement from the Datadog SDK.

Usage #

ddLogger.addTag('restaurant_type', 'pizza');
ddLogger.removeTag('restaurant_type');

// add attribute to every log
ddLogger.addAttribute('toppings', 'extra_cheese');

// add atttributes to some logs
ddLogger.log('time to cook pizza', Level.FINE, attributes: {
  'durationInMilliseconds': timer.elapsedMilliseconds,
});

FAQ #

How do I disable logging when I'm developing locally? #

By default, the DatadogFlutter default constructor will send all logs from Logger to Datadog. To ignore, set bindOnRecord:

DatadogFlutter(
  clientToken: myDatadogClientToken,
  bindOnRecord: false,
)

And log conditionally later:

Logger.root.onRecord.listen((record) async {
  if (shouldSendToDatadog) {
    ddLogger.onRecordCallback(record)
  }
});
13
likes
0
pub points
71%
popularity

Publisher

unverified uploader

Log to Datadog from Flutter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, http, logging, meta

More

Packages that depend on datadog_flutter