Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNa
import EventEmitter from '../vendor/emitter/EventEmitter';

const BatchedBridge = require('../BatchedBridge/BatchedBridge').default;
const infoLog = require('../Utilities/infoLog').default;
const TaskQueue = require('./TaskQueue').default;
const invariant = require('invariant');

Expand Down Expand Up @@ -74,7 +73,7 @@ const InteractionManagerImpl = {
* Notify manager that an interaction has started.
*/
createInteractionHandle(): Handle {
DEBUG && infoLog('InteractionManager: create interaction handle');
DEBUG && console.log('InteractionManager: create interaction handle');
_scheduleUpdate();
const handle = ++_inc;
_addInteractionSet.add(handle);
Expand All @@ -85,7 +84,7 @@ const InteractionManagerImpl = {
* Notify manager that an interaction has completed.
*/
clearInteractionHandle(handle: Handle) {
DEBUG && infoLog('InteractionManager: clear interaction handle');
DEBUG && console.log('InteractionManager: clear interaction handle');
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
_scheduleUpdate();
_addInteractionSet.delete(handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

const infoLog = require('../Utilities/infoLog').default;

type Handler = {
onIterate?: () => void,
onStall: (params: {lastInterval: number, busyTime: number, ...}) => ?string,
Expand All @@ -35,7 +33,7 @@ const JSEventLoopWatchdog = {
return {stallCount, totalStallTime, longestStall, acceptableBusyTime};
},
reset: function () {
infoLog('JSEventLoopWatchdog: reset');
console.log('JSEventLoopWatchdog: reset');
totalStallTime = 0;
stallCount = 0;
longestStall = 0;
Expand Down Expand Up @@ -65,7 +63,7 @@ const JSEventLoopWatchdog = {
handlers.forEach(handler => {
msg += handler.onStall({lastInterval, busyTime}) || '';
});
infoLog(msg);
console.log(msg);
}
handlers.forEach(handler => {
handler.onIterate && handler.onIterate();
Expand Down
15 changes: 7 additions & 8 deletions packages/react-native/Libraries/Interaction/TaskQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';

const infoLog = require('../Utilities/infoLog').default;
const invariant = require('invariant');

export type SimpleTask = {
Expand Down Expand Up @@ -100,18 +99,18 @@ class TaskQueue {
const task = queue.shift();
try {
if (typeof task === 'object' && task.gen) {
DEBUG && infoLog('TaskQueue: genPromise for task ' + task.name);
DEBUG && console.log('TaskQueue: genPromise for task ' + task.name);
this._genPromise(task);
} else if (typeof task === 'object' && task.run) {
DEBUG && infoLog('TaskQueue: run task ' + task.name);
DEBUG && console.log('TaskQueue: run task ' + task.name);
task.run();
} else {
invariant(
typeof task === 'function',
'Expected Function, SimpleTask, or PromiseTask, but got:\n' +
JSON.stringify(task, null, 2),
);
DEBUG && infoLog('TaskQueue: run anonymous task');
DEBUG && console.log('TaskQueue: run anonymous task');
task();
}
} catch (e) {
Expand Down Expand Up @@ -141,7 +140,7 @@ class TaskQueue {
) {
this._queueStack.pop();
DEBUG &&
infoLog('TaskQueue: popped queue: ', {
console.log('TaskQueue: popped queue: ', {
stackIdx,
queueStackSize: this._queueStack.length,
});
Expand All @@ -159,13 +158,13 @@ class TaskQueue {
this._queueStack.push({tasks: [], popable: false});
const stackIdx = this._queueStack.length - 1;
const stackItem = this._queueStack[stackIdx];
DEBUG && infoLog('TaskQueue: push new queue: ', {stackIdx});
DEBUG && infoLog('TaskQueue: exec gen task ' + task.name);
DEBUG && console.log('TaskQueue: push new queue: ', {stackIdx});
DEBUG && console.log('TaskQueue: exec gen task ' + task.name);
task
.gen()
.then(() => {
DEBUG &&
infoLog('TaskQueue: onThen for gen task ' + task.name, {
console.log('TaskQueue: onThen for gen task ' + task.name, {
stackIdx,
queueStackSize: this._queueStack.length,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type {

import BugReporting from '../BugReporting/BugReporting';
import createPerformanceLogger from '../Utilities/createPerformanceLogger';
import infoLog from '../Utilities/infoLog';
import SceneTracker from '../Utilities/SceneTracker';
import {coerceDisplayMode} from './DisplayMode';
import HeadlessJsTaskError from './HeadlessJsTaskError';
Expand Down Expand Up @@ -167,7 +166,7 @@ export function runApplication(
if (appKey !== 'LogBox') {
const logParams = __DEV__ ? ` with ${JSON.stringify(appParameters)}` : '';
const msg = `Running "${appKey}"${logParams}`;
infoLog(msg);
console.log(msg);
BugReporting.addSource(
'AppRegistry.runApplication' + runCount++,
() => msg,
Expand Down Expand Up @@ -199,7 +198,7 @@ export function setSurfaceProps(
appKey +
'" with ' +
JSON.stringify(appParameters);
infoLog(msg);
console.log(msg);
BugReporting.addSource(
'AppRegistry.setSurfaceProps' + runCount++,
() => msg,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import type {
Timespan,
} from './IPerformanceLogger';

import infoLog from './infoLog';

const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally committing `true`;

export const getCurrentTimestamp: () => number =
Expand All @@ -38,13 +36,16 @@ class PerformanceLogger implements IPerformanceLogger {
) {
if (this._closed) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog('PerformanceLogger: addTimespan - has closed ignoring: ', key);
console.log(
'PerformanceLogger: addTimespan - has closed ignoring: ',
key,
);
}
return;
}
if (this._timespans[key]) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: Attempting to add a timespan that already exists ',
key,
);
Expand Down Expand Up @@ -79,7 +80,7 @@ class PerformanceLogger implements IPerformanceLogger {
this._extras = {};
this._points = {};
if (PRINT_TO_CONSOLE) {
infoLog('PerformanceLogger.js', 'clear');
console.log('PerformanceLogger.js', 'clear');
}
}

Expand All @@ -92,7 +93,7 @@ class PerformanceLogger implements IPerformanceLogger {
this._extras = {};
this._points = {};
if (PRINT_TO_CONSOLE) {
infoLog('PerformanceLogger.js', 'clearCompleted');
console.log('PerformanceLogger.js', 'clearCompleted');
}
}

Expand Down Expand Up @@ -133,17 +134,17 @@ class PerformanceLogger implements IPerformanceLogger {
// log timespans
for (const key in this._timespans) {
if (this._timespans[key]?.totalTime != null) {
infoLog(key + ': ' + this._timespans[key].totalTime + 'ms');
console.log(key + ': ' + this._timespans[key].totalTime + 'ms');
}
}

// log extras
infoLog(this._extras);
console.log(this._extras);

// log points
for (const key in this._points) {
if (this._points[key] != null) {
infoLog(key + ': ' + this._points[key] + 'ms');
console.log(key + ': ' + this._points[key] + 'ms');
}
}
}
Expand All @@ -156,13 +157,16 @@ class PerformanceLogger implements IPerformanceLogger {
) {
if (this._closed) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog('PerformanceLogger: markPoint - has closed ignoring: ', key);
console.log(
'PerformanceLogger: markPoint - has closed ignoring: ',
key,
);
}
return;
}
if (this._points[key] != null) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: Attempting to mark a point that has been already logged ',
key,
);
Expand All @@ -184,14 +188,14 @@ class PerformanceLogger implements IPerformanceLogger {
setExtra(key: string, value: ExtraValue) {
if (this._closed) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog('PerformanceLogger: setExtra - has closed ignoring: ', key);
console.log('PerformanceLogger: setExtra - has closed ignoring: ', key);
}
return;
}

if (this._extras.hasOwnProperty(key)) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: Attempting to set an extra that already exists ',
{key, currentValue: this._extras[key], attemptedValue: value},
);
Expand All @@ -208,7 +212,7 @@ class PerformanceLogger implements IPerformanceLogger {
) {
if (this._closed) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: startTimespan - has closed ignoring: ',
key,
);
Expand All @@ -218,7 +222,7 @@ class PerformanceLogger implements IPerformanceLogger {

if (this._timespans[key]) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: Attempting to start a timespan that already exists ',
key,
);
Expand All @@ -231,7 +235,7 @@ class PerformanceLogger implements IPerformanceLogger {
startExtras: extras,
};
if (PRINT_TO_CONSOLE) {
infoLog('PerformanceLogger.js', 'start: ' + key);
console.log('PerformanceLogger.js', 'start: ' + key);
}
}

Expand All @@ -242,15 +246,18 @@ class PerformanceLogger implements IPerformanceLogger {
) {
if (this._closed) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog('PerformanceLogger: stopTimespan - has closed ignoring: ', key);
console.log(
'PerformanceLogger: stopTimespan - has closed ignoring: ',
key,
);
}
return;
}

const timespan = this._timespans[key];
if (!timespan || timespan.startTime == null) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: Attempting to end a timespan that has not started ',
key,
);
Expand All @@ -259,7 +266,7 @@ class PerformanceLogger implements IPerformanceLogger {
}
if (timespan.endTime != null) {
if (PRINT_TO_CONSOLE && __DEV__) {
infoLog(
console.log(
'PerformanceLogger: Attempting to end a timespan that has already ended ',
key,
);
Expand All @@ -271,7 +278,7 @@ class PerformanceLogger implements IPerformanceLogger {
timespan.endTime = timestamp;
timespan.totalTime = timespan.endTime - (timespan.startTime || 0);
if (PRINT_TO_CONSOLE) {
infoLog('PerformanceLogger.js', 'end: ' + key);
console.log('PerformanceLogger.js', 'end: ' + key);
}
}
}
Expand Down
20 changes: 0 additions & 20 deletions packages/react-native/Libraries/Utilities/infoLog.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8766,12 +8766,6 @@ declare export default typeof dismissKeyboard;
"
`;

exports[`public API should not change unintentionally Libraries/Utilities/infoLog.js 1`] = `
"declare function infoLog(...args: Array<mixed>): void;
declare export default typeof infoLog;
"
`;

exports[`public API should not change unintentionally Libraries/Utilities/logError.js 1`] = `
"declare const logError: (...args: $ReadOnlyArray<mixed>) => void;
declare export default typeof logError;
Expand Down
3 changes: 1 addition & 2 deletions packages/rn-tester/js/examples/FlatList/FlatList-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
TextInput,
View,
} from 'react-native';
import infoLog from 'react-native/Libraries/Utilities/infoLog';

const PAGE_SIZE = 100;
const NUM_PAGES = 10;
Expand Down Expand Up @@ -402,7 +401,7 @@ class FlatListExample extends React.PureComponent<Props, State> {
}) => {
// Impressions can be logged here
if (this.state.logViewable) {
infoLog(
console.log(
'onViewableItemsChanged: ',
info.changed.map(v => ({...v, item: '...'})),
);
Expand Down
Loading