Summary: Changelog: Logs plugin now supports physical iOS devices As reported in https://github.com/facebook/flipper/issues/262 and linked papercut. This diff adds support for iOS device logs through idb. Since idb doesn't respect `--json` flag at the moment, we perform the parsing in Flipper itself. Reviewed By: passy Differential Revision: D27346262 fbshipit-source-id: 3b314716f48bb9a7fe709370303396a51893359c
50 lines
2.8 KiB
TypeScript
50 lines
2.8 KiB
TypeScript
/**
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*
|
||
* @format
|
||
*/
|
||
|
||
import IOSDevice from '../IOSDevice';
|
||
|
||
test('can parse log', () => {
|
||
const input = `Mar 25 17:06:38 iPhone symptomsd(SymptomEvaluator)[125] <Notice>: L2 Metrics on en0: rssi: -64 [0,0] -> -64, snr: 0 (cca [wake/total] self/other/intf): [0,0]/[0,0]/[0,0]/16 (txFrames/txReTx/txFail): 0/0/0 -> (was/is) 0/0`;
|
||
const parsed = IOSDevice.parseLogLine(input);
|
||
expect(parsed).toMatchObject({
|
||
message:
|
||
'L2 Metrics on en0: rssi: -64 [0,0] -> -64, snr: 0 (cca [wake/total] self/other/intf): [0,0]/[0,0]/[0,0]/16 (txFrames/txReTx/txFail): 0/0/0 -> (was/is) 0/0',
|
||
pid: 125,
|
||
tag: 'symptomsd(SymptomEvaluator)',
|
||
tid: 0,
|
||
type: 'verbose',
|
||
});
|
||
// don't check everything as parsing is time zone dependent
|
||
expect(parsed?.date.getMonth()).toBe(2);
|
||
expect(parsed?.date.getMinutes()).toBe(6);
|
||
expect(parsed?.date.getSeconds()).toBe(38);
|
||
});
|
||
|
||
test('all parseable', () => {
|
||
const inputs = [
|
||
`Mar 26 10:00:40 iPhone kernel(AppleBCMWLANCore)[0] <Notice>: LQM-WiFi: (2G) rxCrsGlitch=409 rxBphyCrsGlitch=226 rxStart=5672 rxBadPLCP=22 rxBphyBadPLCP=2 rxBadFCS=1740 rxFifo0Ovfl=0 rxFifo1Ovfl=0 rx_nobuf=0 rxAnyErr=48 rxResponseTimeout=612 rxNoDelim=18 rxFrmTooLong=0 rxFrmTooShort=10`,
|
||
`Mar 26 10:04:37 iPhone nsurlsessiond[108] <Notice>: NDSession <7E18A208-B0F3-400D-916E-AD844AF190F2> Task <5331FB72-769E-4B22-8EDF-3D4944B1970A>.<5> did receive data (629823296 of 1953496076 total bytes)`,
|
||
`Apr 2 03:00:26 iPhone locationd[4718] <Notice>: @ClxGps, Fix, 0, ll, N/A`,
|
||
];
|
||
inputs.forEach((input) => {
|
||
expect(IOSDevice.parseLogLine(input)).toBeDefined();
|
||
});
|
||
});
|
||
|
||
test('splits', () => {
|
||
const input = `Mar 26 10:26:57 iPhone containermanagerd[4981] <Notice>: stat [<private>]: exists: 1, isDirectory: 0, fsNode: <~~~>
|
||
|