datadog_flutter 0.0.2
datadog_flutter: ^0.0.2

Flutter Android iOS

Community implementation of native bindings for Datadog's SDK. Not an official package.

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)
  }
});
0
likes
100
pub points
22%
popularity

Community implementation of native bindings for Datadog's SDK. Not an official package.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

tshedor@greenbits.com

License

MIT (LICENSE)

Dependencies

flutter, http, logging, meta

More

Packages that depend on datadog_flutter