setupLogger function

void setupLogger()

Implementation

void setupLogger() {
  Logger.root.level = Level.ALL;
  Logger.root.onRecord.listen((record) {
    String emoji = '';
    if (record.level == Level.INFO) {
      emoji = '';
    } else if (record.level == Level.WARNING) {
      emoji = '❗️';
    } else if (record.level == Level.SEVERE) {
      emoji = '⛔️';
    }
    if (record.level == Level.SEVERE || !kReleaseMode) {
      debugPrint('$emoji   ${record.level.name}: ${record.message}');
    }
    if (record.error != null) {
      debugPrint('👉 ${record.error}');
    }
    if (record.level == Level.SEVERE) {
      debugPrint('👉 ${record.error}');
      //debugPrintStack(stackTrace: record.stackTrace);
    }
  });
}