Skip to content

Commit c31fa2a

Browse files
cpojerfacebook-github-bot
authored andcommitted
Do not show setup logs from createPerformanceLogger unless logs are enabled for it
Summary: This module logs helpful messages in `__DEV__` but it only logs actionable performance logs when the flag on top of the file is enabled. This diff changes those to only log when the toggle on top of the file is enabled as well. Reviewed By: gaearon Differential Revision: D16107933 fbshipit-source-id: 7671bc521af984d617a0f5ffc0eacd1aa5674a62
1 parent d57cdac commit c31fa2a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Libraries/Utilities/createPerformanceLogger.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function createPerformanceLogger(): IPerformanceLogger {
6767

6868
addTimespan(key: string, lengthInMs: number, description?: string) {
6969
if (this._timespans[key]) {
70-
if (__DEV__) {
70+
if (PRINT_TO_CONSOLE && __DEV__) {
7171
infoLog(
7272
'PerformanceLogger: Attempting to add a timespan that already exists ',
7373
key,
@@ -84,7 +84,7 @@ function createPerformanceLogger(): IPerformanceLogger {
8484

8585
startTimespan(key: string, description?: string) {
8686
if (this._timespans[key]) {
87-
if (__DEV__) {
87+
if (PRINT_TO_CONSOLE && __DEV__) {
8888
infoLog(
8989
'PerformanceLogger: Attempting to start a timespan that already exists ',
9090
key,
@@ -106,7 +106,7 @@ function createPerformanceLogger(): IPerformanceLogger {
106106
stopTimespan(key: string) {
107107
const timespan = this._timespans[key];
108108
if (!timespan || !timespan.startTime) {
109-
if (__DEV__) {
109+
if (PRINT_TO_CONSOLE && __DEV__) {
110110
infoLog(
111111
'PerformanceLogger: Attempting to end a timespan that has not started ',
112112
key,
@@ -115,7 +115,7 @@ function createPerformanceLogger(): IPerformanceLogger {
115115
return;
116116
}
117117
if (timespan.endTime) {
118-
if (__DEV__) {
118+
if (PRINT_TO_CONSOLE && __DEV__) {
119119
infoLog(
120120
'PerformanceLogger: Attempting to end a timespan that has already ended ',
121121
key,
@@ -203,7 +203,7 @@ function createPerformanceLogger(): IPerformanceLogger {
203203

204204
setExtra(key: string, value: any) {
205205
if (this._extras[key]) {
206-
if (__DEV__) {
206+
if (PRINT_TO_CONSOLE && __DEV__) {
207207
infoLog(
208208
'PerformanceLogger: Attempting to set an extra that already exists ',
209209
{key, currentValue: this._extras[key], attemptedValue: value},
@@ -230,7 +230,7 @@ function createPerformanceLogger(): IPerformanceLogger {
230230

231231
markPoint(key: string, timestamp?: number) {
232232
if (this._points[key]) {
233-
if (__DEV__) {
233+
if (PRINT_TO_CONSOLE && __DEV__) {
234234
infoLog(
235235
'PerformanceLogger: Attempting to mark a point that has been already logged ',
236236
key,

0 commit comments

Comments
 (0)