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 theatatus_flutter_plugin dependency to your pubspec.yaml:
2. Enable Logging
Enable logging by passing aloggingConfiguration 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: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: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.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
- Set up RUM for Flutter to track views, actions, and errors.
- Collect logs from your native Android apps with Android Log Collection.
- Explore your logs in Logs Monitoring.