Logs And Performance

About Logging

Logging library which handles cloud (e.g. sentry, crashanalytics) and local (e.g. Console/Terminal and Local Files For Device) Logs.

  • So developer should never use individual service in their application, they should always use Logging library for logging any kind of content.
  • To setup Sentry please check this.

Use cases

Log types

Currently, our logs are of six types.

  1. log
  2. info
  3. success
  4. warning
  5. exception
  6. transaction

For Local Logs: Different types will print logs in different colors. the log will be in grey, info in blue, success in green, warning in yellow, and exception will be in red.

How to use

Call static methods of the Log class to log the events.

try {
  // code snippet
} catch (error, stackTrace){
  Log.exception(error, stackTrace: stackTrace);

Log Transactions

When developer wants to measure performance of different operations they can use logTransaction funtion. Where developer will have to pass operation for which they wants to log as execute argument. e.g. API send receive requests, getting a file from local storage and parsing data, processing huge data, search queries, etc.

  execute: () async => {},
  details: const TransactionDetails(
    name: 'idle transaction',
    operation: 'idle',
  execute: Api.ajax(''),
  details: const TransactionDetails(
    name: 'get root route of vaah api',
    operation: 'read',

To print data, as argument pass the data

Map<String, dynamic> data = {
  "first_key": "value",
  "second_key": [
    {"key": "value"},
    {"key": "updated_value"},
};'data', data: data);



You can disable local and cloud logging for specific log

Log.exception('exception', disableLocalLogging: true);'log', disableCloudLogging: true);

For exception you can pass two extra parameters: stackTrace and hint

catch (error, stackTrace){
        stackTrace: stackTrace,
        hint: 'The exception is caught in ---',

About Performance

Use cases

  • To enable/ disable all kind of tracking, switch enableAutoPerformanceTracing
  • Record cold startup time and warm startup time
  • Observe Navigation
  • Capture User Interactions
  • Capture Assets Performance
  • Observe transactions
  • Record Slow and Frozen frames (Yet to implement)


  • To configure sentry for your project you just have to pass sentryConfig in environment config.
  • Check this video for, how to get config values.
  • To disable all kind of tracing set enableAutoPerformanceTracing to false.
  • To record cold startup time and warm startup time set autoAppStart to true, check this section.
  • To record User Interaction set enableUserInteractionTracing to true, check this section.
  • To enable assets instrumentation set enableAssetsInstrumentation to true.

How to use

Just toogle environment flags (mentioned above) to enable/ disable monitoring.

Copyright © 2024