setUp static method

void setUp({
  1. bool logTime = false,
  2. LogLevel logLevel = LogLevel.info,
  3. AnalyticsInterface? analyticsInterface,
  4. CrashReportsInterface? crashReportsInterface,
  5. void analytics(
    1. AnalyticsFactory analyticsFactory
    )?,
  6. int? maxLinesStackTrace,
  7. bool combineEvents = true,
  8. bool addAnalyticsToCrashReports = true,
  9. CrashReportType crashReportType = CrashReportType.location,
})

Used to configure the logging and analytic abilities of the Loglytics.

Use the analyticsInterface and crashReportsInterface to specify your implementations of both functionalities. This is optional as the Loglytics can also be used as a pure logger. Populate the analytics parameter with callbacks to your Analytics implementations. Example: () => CounterAnalytics(), () => CookieAnalytics().

Implementation

static void setUp({
  bool logTime = false,
  LogLevel logLevel = LogLevel.info,
  AnalyticsInterface? analyticsInterface,
  CrashReportsInterface? crashReportsInterface,
  void Function(AnalyticsFactory analyticsFactory)? analytics,
  int? maxLinesStackTrace,
  bool combineEvents = true,
  bool addAnalyticsToCrashReports = true,
  CrashReportType crashReportType = CrashReportType.location,
}) {
  Log.logTime = logTime;
  Log.level = logLevel;
  _analyticsInterface = analyticsInterface;
  _crashReportsInterface = crashReportsInterface;
  if (analytics != null) {
    registerAnalytics(analytics: analytics);
  }
  _maxLinesStackTrace = maxLinesStackTrace;
  _combineEvents = combineEvents;
  _addAnalyticsToCrashReports = addAnalyticsToCrashReports;
  _eventBus._listen();
  _isActive = true;
  _crashReportType = crashReportType;
}