Fix for plugin failures showing up as platform failures

Summary: This got broken during TS migration. Plugin failures were being logged as platform failures, and showing up in the wrong graphs.

Reviewed By: passy

Differential Revision: D18059046

fbshipit-source-id: 8209a0e852f62e221bf64cb5091115e3cac09fd9
This commit is contained in:
John Knox
2019-10-22 08:44:08 -07:00
committed by Facebook Github Bot
parent a77064ad84
commit d350e1b339
4 changed files with 162 additions and 26 deletions

View File

@@ -9,7 +9,16 @@
import {Store} from '../../reducers/index';
import {getStringFromErrorLike} from '../../utils/errors';
import {Args, Logger, TrackType} from '../../fb-interfaces/Logger';
import {Args, Logger} from '../../fb-interfaces/Logger';
const instance = {
track: jest.fn(),
trackTimeSince: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
debug: jest.fn(),
};
export function extractError(
...data: Array<any>
@@ -22,30 +31,10 @@ export function extractError(
};
}
export class FBLogger implements Logger {
constructor(_store?: Store, _args?: Args) {}
track(_type: TrackType, _event: string, _data?: any, _plugin?: string) {}
trackTimeSince(_mark: string, _eventName?: string) {}
info = (..._data: Array<any>) => {};
warn = (..._data: Array<any>) => {};
error = (..._data: Array<any>) => {};
debug = (..._data: Array<any>) => {};
getLogs(): Array<string> {
return [];
}
}
export function init(_store: Store, _args?: Args): Logger {
return new FBLogger();
return instance;
}
export function getInstance(): Logger {
return new FBLogger();
return instance;
}