Skip to main content

Methods

Marco provides several methods to help you track custom events, reset all logs at any point, and retrieve performance logs for analysis.

track

Custom performance markers can be sent at any point in app to measure specific events or actions.

For example:

// Without metadata
PerformanceTracker.track('start_event', Date.now());

// With metadata
PerformanceTracker.track('start_event', Date.now(), { data: 'meta_data' });
tip

In order to track native events, use Native Event Logging methods.

getLogs

You can retrieve all performance logs asynchronously using the getLogs method. This allows you to analyze performance data after it has been collected.

For example:

const logs = await PerformanceTracker.getLogs();

Logs are structured in a JSON format, and can be analyzed as needed.

note

This will give in memory logs. To get logs from device use generate command.

resetLogs

You can clear all performance logs at any time. This can be done through the resetLogs method.

For example:

// This will clear in memory logs.
PerformanceTracker.resetLogs();

// This will clear in memory logs and also clear the persisted log files if `persistToFile` is true.
PerformanceTracker.resetLogs({ clearFiles: true });

This will reset the logs and optionally clear the persisted log files.

danger
  • clearFiles will clear all the logs from the device. Be sure to save the logs before clearing using generate command.
  • This will clear all the logs from the device, including native events.