runSyslog function

Future<SyslogResult> runSyslog(
  1. SyslogInput input
)

Reads native system logs from the device under debug.

Platform dispatch: Android — adb logcat iOS simulator — xcrun simctl spawn device log show / stream iOS physical — idevicesyslog (requires libimobiledevice) macOS — log show / stream

Never throws; all error conditions are represented as sealed result cases.

Implementation

Future<SyslogResult> runSyslog(SyslogInput input) async {
  final platformInfo = readPlatformInfo();
  if (platformInfo == null) {
    return const SyslogError('No platform info found. Is the app running?');
  }

  final platform = platformInfo.platform.toLowerCase();
  final emulator = platformInfo.emulator;
  final device = readDevice();

  if (platform.startsWith('android')) {
    return _runAndroid(device: device, input: input);
  } else if (platform == 'ios' || platform.startsWith('ios-')) {
    if (emulator) {
      return _runIosSimulator(device: device, input: input);
    } else {
      return _runIosPhysical(input: input);
    }
  } else if (platform == 'darwin' || platform == 'macos') {
    return _runMacos(input: input);
  } else {
    return SyslogError('Unsupported platform: $platform');
  }
}