From b42abcbb5902e119ac85391c81776d87e0408530 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Fri, 9 Aug 2019 10:32:36 -0700 Subject: [PATCH] Migrate logger Summary: Removed defunct log filtering functionality, but we probably want to rebuild that. Funny that tsc caught this as non functioning but Flow happily accepted it. Reviewed By: danielbuechele Differential Revision: D16690959 fbshipit-source-id: b079dd6faba83ca0c443d00cbb69c8ff95c4fa69 --- headless/index.js | 2 +- src/__tests__/App.electron.js | 2 +- src/chrome/RatingButton.js | 2 +- src/dispatcher/__tests__/plugins.electron.js | 2 +- src/fb-stubs/{Logger.js => Logger.tsx} | 12 ++++++------ src/init.js | 2 +- src/utils/InteractionTracker.js | 2 +- src/utils/exportData.js | 2 +- src/utils/metrics.js | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) rename src/fb-stubs/{Logger.js => Logger.tsx} (77%) diff --git a/headless/index.js b/headless/index.js index 224222ff9..e5b9ceae8 100644 --- a/headless/index.js +++ b/headless/index.js @@ -10,8 +10,8 @@ import {createStore} from 'redux'; import {applyMiddleware} from 'redux'; import yargs from 'yargs'; import dispatcher from '../src/dispatcher/index.tsx'; -import {init as initLogger} from '../src/fb-stubs/Logger.js'; import reducers from '../src/reducers/index.tsx'; +import {init as initLogger} from '../src/fb-stubs/Logger.tsx'; import {exportStore, pluginsClassMap} from '../src/utils/exportData.js'; import { exportMetricsWithoutTrace, diff --git a/src/__tests__/App.electron.js b/src/__tests__/App.electron.js index 3b69e0ceb..b99390d54 100644 --- a/src/__tests__/App.electron.js +++ b/src/__tests__/App.electron.js @@ -10,7 +10,7 @@ import {Provider} from 'react-redux'; import renderer from 'react-test-renderer'; import reducers from '../reducers/index.tsx'; import configureStore from 'redux-mock-store'; -import {init as initLogger} from '../fb-stubs/Logger'; +import {init as initLogger} from '../fb-stubs/Logger.tsx'; import BugReporter from '../fb-stubs/BugReporter.tsx'; // create redux store with initial state diff --git a/src/chrome/RatingButton.js b/src/chrome/RatingButton.js index 0b1db44b6..f42a4e293 100644 --- a/src/chrome/RatingButton.js +++ b/src/chrome/RatingButton.js @@ -7,7 +7,7 @@ import {Component, type Element, Fragment} from 'react'; import {Glyph, Tooltip} from 'flipper'; -import {getInstance as getLogger} from '../fb-stubs/Logger'; +import {getInstance as getLogger} from '../fb-stubs/Logger.tsx'; import GK from '../fb-stubs/GK.tsx'; type Props = { diff --git a/src/dispatcher/__tests__/plugins.electron.js b/src/dispatcher/__tests__/plugins.electron.js index 3331adeee..eb38d1aa9 100644 --- a/src/dispatcher/__tests__/plugins.electron.js +++ b/src/dispatcher/__tests__/plugins.electron.js @@ -15,7 +15,7 @@ import path from 'path'; import {remote} from 'electron'; import {FlipperPlugin} from '../../plugin.tsx'; import reducers from '../../reducers/index.tsx'; -import {init as initLogger} from '../../fb-stubs/Logger.js'; +import {init as initLogger} from '../../fb-stubs/Logger.tsx'; import configureStore from 'redux-mock-store'; import {TEST_PASSING_GK, TEST_FAILING_GK} from '../../fb-stubs/GK.tsx'; import TestPlugin from './TestPlugin'; diff --git a/src/fb-stubs/Logger.js b/src/fb-stubs/Logger.tsx similarity index 77% rename from src/fb-stubs/Logger.js rename to src/fb-stubs/Logger.tsx index 4f97d5070..5c0cdbb7f 100644 --- a/src/fb-stubs/Logger.js +++ b/src/fb-stubs/Logger.tsx @@ -5,14 +5,14 @@ * @format */ -import type {TrackType, Logger} from '../fb-interfaces/Logger'; -import type {Store} from '../reducers/index.tsx'; +import {TrackType, Logger} from '../fb-interfaces/Logger'; +import {Store} from '../reducers/index'; import ScribeLogger from './ScribeLogger'; -let instance: ?StubLogger = null; +let instance: StubLogger = null; type Args = { - isHeadless?: boolean, + isHeadless?: boolean; }; class StubLogger implements Logger { @@ -22,9 +22,9 @@ class StubLogger implements Logger { scribeLogger: ScribeLogger; - track(type: TrackType, event: string, data: ?any, plugin?: string) {} + track(type: TrackType, event: string, data?: any, plugin?: string) {} - trackTimeSince(mark: string, eventName: ?string) {} + trackTimeSince(mark: string, eventName?: string) {} info(data: any, category: string) {} diff --git a/src/init.js b/src/init.js index 194258cbe..4e0e3516b 100644 --- a/src/init.js +++ b/src/init.js @@ -9,7 +9,7 @@ import {Provider} from 'react-redux'; import ReactDOM from 'react-dom'; import {ContextMenuProvider} from 'flipper'; import GK from './fb-stubs/GK.tsx'; -import {init as initLogger} from './fb-stubs/Logger'; +import {init as initLogger} from './fb-stubs/Logger.tsx'; import App from './App.js'; import BugReporter from './fb-stubs/BugReporter.tsx'; import setupPrefetcher from './fb-stubs/Prefetcher.tsx'; diff --git a/src/utils/InteractionTracker.js b/src/utils/InteractionTracker.js index ebf86ce1f..f30a7981b 100644 --- a/src/utils/InteractionTracker.js +++ b/src/utils/InteractionTracker.js @@ -5,7 +5,7 @@ * @format */ -import {getInstance as getLogger} from '../fb-stubs/Logger'; +import {getInstance as getLogger} from '../fb-stubs/Logger.tsx'; export function reportInteraction( componentType: string, diff --git a/src/utils/exportData.js b/src/utils/exportData.js index c541969c2..7918d69d2 100644 --- a/src/utils/exportData.js +++ b/src/utils/exportData.js @@ -4,8 +4,8 @@ * LICENSE file in the root directory of this source tree. * @format */ -import {getInstance as getLogger} from '../fb-stubs/Logger'; import type {Store, MiddlewareAPI} from '../reducers.tsx'; +import {getInstance as getLogger} from '../fb-stubs/Logger.tsx'; import type {DeviceExport} from '../devices/BaseDevice.tsx'; import type {State as PluginStates} from '../reducers/pluginStates.tsx'; import type {PluginNotification} from '../reducers/notifications.tsx'; diff --git a/src/utils/metrics.js b/src/utils/metrics.js index f77019c9d..4b558ca13 100644 --- a/src/utils/metrics.js +++ b/src/utils/metrics.js @@ -5,7 +5,7 @@ * @format */ -import {getInstance} from '../fb-stubs/Logger'; +import {getInstance} from '../fb-stubs/Logger.tsx'; export class UnsupportedError extends Error { constructor(message: string) {