m8ty_remote_logging
It’s hard to replicate some issues and to investigate them by not having the logs. This package should support you in sending the logs to server during the runtime of the application automatically.
Setup the package
Section titled “Setup the package”Install package
Section titled “Install package” m8ty_device_info: git: git@gitlab.m8ty.eu:app-framework/infra/m8ty_remote_logging.gitInitialize the package
Section titled “Initialize the package”void main() async { WidgetsFlutterBinding.ensureInitialized(); await M8tyRemoteLoggingService.initialize( apiKey: "85e2f8cg-88a7-4e77-aede-6b5745749088", shouldLog: (_) => true, baseUrl: "https://api-dev.m8ty.eu/api/v1", );
runApp(const MyApp());}And that’s it :-)
| Parameter | Description |
|---|---|
| apiKey | Key configured on the server so that you can access the API |
| shouldLog | There may be cases that your logger filter is enabled, but you don't want to send the data to the server. By default if the parameter is not set logs will be sent only in Debug Mode |
| baseUrl | Url to the server API responsible for logging |
| timerDuration | How often should the logs be sent to the server |
| metaData | There are default meta data like appName, version, os etc. being send to the server. Here you can define additional metadata like some details about the user (not confidential) |
How does it work behind the scenes
Section titled “How does it work behind the scenes”As you are using logger package an listener is automatically attached to that logger. So you are using the logger as usual and the data
- Added to the queue
- Persisted to the device
- Transferred to the server
- Removed from the device storage
Offline support
Section titled “Offline support”As shared_preferences are used for the persistence of the log entries data will be written locally as long as the device is offline. As soon as the device is online, the data will be transferred to the server.
© m8ty GmbH 2023 · m8ty.eu
