The Atatus mobile SDK lets you send logs from your Flutter applications directly to Atatus. Logs are sent over HTTP, batched on the device, and can be enriched with attributes and tags and correlated with your RUM sessions.

Prerequisites

  • The Atatus SDK is initialized in your application. See Flutter Monitoring Setup for the initialization steps.
  • A RUM application created in Atatus, which gives you a License Key.
The SDK requires a License Key. Do not use your account API key in a mobile application, because it would be exposed in the application’s byte code.

Setup

1. Add the Plugin

If you have not already added the SDK, add the atatus_flutter_plugin dependency to your pubspec.yaml:
Then fetch the package:

2. Enable Logging

Enable logging by passing a loggingConfiguration when you initialize the SDK. See Flutter Monitoring Setup for the full initialization:

3. Create a Logger

After the SDK is initialized, create a logger and configure it with the options you need:
AtatusLoggerConfiguration options: LogLevel has eight members, in ascending order of severity: debug, info, notice, warning, error, critical, alert, emergency.
Only debug, info, warning, and error have a matching logger method. The remaining levels are accepted by remoteLogThreshold but are not yet emitted by the Flutter SDK. Note that the enum member is LogLevel.warning while the method is logger.warn().

4. Send Log Messages

Use the logger to send messages at the level you need:
Attach custom attributes to a single log entry:

5. Create Additional Loggers

You can create multiple loggers, each with its own service and name, to separate logs from different parts of your application:

6. Manage Attributes and Tags

Attributes are key-value pairs attached to your logs. Add or remove them on a logger at any time:
Tags help you filter and group your logs in Atatus. A tag is added as a key:value pair, or as a plain string when you pass no value:
removeTag matches the complete tag string, so removeTag('build_type') does not remove build_type:release. To remove a tag by its key alone, use removeTagWithKey.
To attach an attribute to every logger rather than just one, set it on the logs feature:

7. Sending Data When the Device Is Offline

Logs are batched locally and sent to Atatus when network availability and battery levels permit. Even if your users open the application while offline, no data is lost. Batches are uploaded once connectivity is restored, and old data automatically expires to keep disk usage bounded.

Next Steps