showDebugInfo method

bool showDebugInfo({
  1. FetchTrayLogLevel logType = FetchTrayLogLevel.info,
  2. FetchTrayDebugLevel? localDebugLevel,
})

lets us easily find out whether to show a specific logType message or not

If a localDebugLevel is provided, our logType will be compared against that If no localDebugLevel is provided, we will use the global one defined by TrayEnvironment initialization.

Implementation

bool showDebugInfo({
  FetchTrayLogLevel logType = FetchTrayLogLevel.info,
  FetchTrayDebugLevel? localDebugLevel,
}) {
  // if we got a local debug level -> check that
  if (localDebugLevel != null) {
    return matchesDebugLevels(
      logType: logType,
      requestDebugLevel: localDebugLevel,
    );
  }

  // otherwise check the global debug level
  return matchesDebugLevels(
    logType: logType,
    requestDebugLevel: debugLevel,
  );
}