Add explicit StubLogger option for tests
Summary: A bit ugly to have test-only code in prod logic, but we don't need any of the logger logic in tests and by pulling out the `StubLogger`, we can avoid loading Electron during tests. Reviewed By: jknoxville Differential Revision: D17808479 fbshipit-source-id: d2295d7bbca2f09c3f23389ad9443648757d8d03
This commit is contained in:
committed by
Facebook Github Bot
parent
d86b8caa2d
commit
3730c523ec
30
src/utils/StubLogger.tsx
Normal file
30
src/utils/StubLogger.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright 2018-present Facebook.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {Logger, Args, TrackType} from '../fb-interfaces/Logger';
|
||||
import ScribeLogger from '../fb-stubs/ScribeLogger';
|
||||
import {Store} from '../reducers/index';
|
||||
|
||||
export default class StubLogger implements Logger {
|
||||
constructor(_store: Store, _args?: Args) {
|
||||
this.scribeLogger = new ScribeLogger(this);
|
||||
}
|
||||
|
||||
scribeLogger: ScribeLogger;
|
||||
|
||||
track(_type: TrackType, _event: string, _data?: any, _plugin?: string) {}
|
||||
|
||||
trackTimeSince(_mark: string, _eventName?: string) {}
|
||||
|
||||
info(_data: any, _category: string) {}
|
||||
|
||||
warn(_data: any, _category: string) {}
|
||||
|
||||
error(_data: any, _category: string) {}
|
||||
|
||||
debug(_data: any, _category: string) {}
|
||||
}
|
||||
Reference in New Issue
Block a user