Skip to content

Commit cd0fd52

Browse files
Update logging message with proper logging levels. (#2706)
* Update logging levels. * Update NetworkRequestMetricBuilder.java * Address comments.
1 parent 257f96b commit cd0fd52

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/FirebasePerformance.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public static FirebasePerformance getInstance() {
193193

194194
mPerformanceCollectionForceEnabledState = configResolver.getIsPerformanceCollectionEnabled();
195195
if (isPerformanceCollectionEnabled()) {
196-
logger.debug(
196+
logger.info(
197197
String.format(
198198
"Firebase Performance Monitoring is successfully initialized! In a minute, visit the Firebase console to view your data: %s",
199199
ConsoleUrlGenerator.generateDashboardUrl(

firebase-perf/src/main/java/com/google/firebase/perf/metrics/NetworkRequestMetricBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public final class NetworkRequestMetricBuilder extends AppStateUpdateHandler
7070
public void updateSession(PerfSession session) {
7171
// Note(b/152218504): Being defensive to fix the NPE
7272
if (session == null) {
73-
logger.info("Unable to add new SessionId to the Network Trace. Continuing without it.");
73+
logger.warn("Unable to add new SessionId to the Network Trace. Continuing without it.");
7474
return;
7575
}
7676

@@ -293,7 +293,7 @@ public NetworkRequestMetricBuilder setResponseContentType(@Nullable String conte
293293
if (isValidContentType(contentType)) {
294294
builder.setResponseContentType(contentType);
295295
} else {
296-
logger.info("The content type of the response is not a valid content-type:" + contentType);
296+
logger.warn("The content type of the response is not a valid content-type:" + contentType);
297297
}
298298
return this;
299299
}
@@ -332,7 +332,7 @@ public NetworkRequestMetric build() {
332332
}
333333

334334
if (isManualNetworkRequestMetric) {
335-
logger.info(
335+
logger.debug(
336336
"This metric has already been queued for transmission. "
337337
+ "Please create a new HttpMetric for each request/response");
338338
}

firebase-perf/src/main/java/com/google/firebase/perf/metrics/Trace.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class Trace extends AppStateUpdateHandler
7575
public void updateSession(PerfSession session) {
7676
// Note(b/152218504): Being defensive to fix the NPE
7777
if (session == null) {
78-
logger.info("Unable to add new SessionId to the Trace. Continuing without it.");
78+
logger.warn("Unable to add new SessionId to the Trace. Continuing without it.");
7979
return;
8080
}
8181

@@ -205,7 +205,7 @@ private Trace(@NonNull Parcel in, boolean isDataOnly) {
205205
@Keep
206206
public void start() {
207207
if (!ConfigResolver.getInstance().isPerformanceMonitoringEnabled()) {
208-
logger.info("Trace feature is disabled.");
208+
logger.debug("Trace feature is disabled.");
209209
return;
210210
}
211211

firebase-perf/src/main/java/com/google/firebase/perf/metrics/validator/FirebasePerfNetworkValidator.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,87 +48,87 @@ final class FirebasePerfNetworkValidator extends PerfMetricValidator {
4848
*/
4949
public boolean isValidPerfMetric() {
5050
if (isEmptyUrl(networkMetric.getUrl())) {
51-
logger.info("URL is missing:" + networkMetric.getUrl());
51+
logger.warn("URL is missing:" + networkMetric.getUrl());
5252
return false;
5353
}
5454
URI uri = getResultUrl(networkMetric.getUrl());
5555
if (uri == null) {
56-
logger.info("URL cannot be parsed");
56+
logger.warn("URL cannot be parsed");
5757
return false;
5858
}
5959

6060
if (!isAllowlisted(uri, appContext)) {
61-
logger.info("URL fails allowlist rule: " + uri);
61+
logger.warn("URL fails allowlist rule: " + uri);
6262
return false;
6363
}
6464
if (!isValidHost(uri.getHost())) {
65-
logger.info("URL host is null or invalid");
65+
logger.warn("URL host is null or invalid");
6666
return false;
6767
}
6868
if (!isValidScheme(uri.getScheme())) {
69-
logger.info("URL scheme is null or invalid");
69+
logger.warn("URL scheme is null or invalid");
7070
return false;
7171
}
7272
if (!isValidUserInfo(uri.getUserInfo())) {
73-
logger.info("URL user info is null");
73+
logger.warn("URL user info is null");
7474
return false;
7575
}
7676
if (!isValidPort(uri.getPort())) {
77-
logger.info("URL port is less than or equal to 0");
77+
logger.warn("URL port is less than or equal to 0");
7878
return false;
7979
}
8080
if (!isValidHttpMethod(networkMetric.hasHttpMethod() ? networkMetric.getHttpMethod() : null)) {
81-
logger.info("HTTP Method is null or invalid: " + networkMetric.getHttpMethod());
81+
logger.warn("HTTP Method is null or invalid: " + networkMetric.getHttpMethod());
8282
return false;
8383
}
8484
if (networkMetric.hasHttpResponseCode()
8585
&& !isValidHttpResponseCode(networkMetric.getHttpResponseCode())) {
86-
logger.info("HTTP ResponseCode is a negative value:" + networkMetric.getHttpResponseCode());
86+
logger.warn("HTTP ResponseCode is a negative value:" + networkMetric.getHttpResponseCode());
8787
return false;
8888
}
8989
if (networkMetric.hasRequestPayloadBytes()
9090
&& !isValidPayload(networkMetric.getRequestPayloadBytes())) {
91-
logger.info("Request Payload is a negative value:" + networkMetric.getRequestPayloadBytes());
91+
logger.warn("Request Payload is a negative value:" + networkMetric.getRequestPayloadBytes());
9292
return false;
9393
}
9494
if (networkMetric.hasResponsePayloadBytes()
9595
&& !isValidPayload(networkMetric.getResponsePayloadBytes())) {
96-
logger.info(
96+
logger.warn(
9797
"Response Payload is a negative value:" + networkMetric.getResponsePayloadBytes());
9898
return false;
9999
}
100100
if (!networkMetric.hasClientStartTimeUs() || networkMetric.getClientStartTimeUs() <= 0) {
101-
logger.info(
101+
logger.warn(
102102
"Start time of the request is null, or zero, or a negative value:"
103103
+ networkMetric.getClientStartTimeUs());
104104
return false;
105105
}
106106
if (networkMetric.hasTimeToRequestCompletedUs()
107107
&& !isValidTime(networkMetric.getTimeToRequestCompletedUs())) {
108-
logger.info(
108+
logger.warn(
109109
"Time to complete the request is a negative value:"
110110
+ networkMetric.getTimeToRequestCompletedUs());
111111
return false;
112112
}
113113
if (networkMetric.hasTimeToResponseInitiatedUs()
114114
&& !isValidTime(networkMetric.getTimeToResponseInitiatedUs())) {
115-
logger.info(
115+
logger.warn(
116116
"Time from the start of the request to the start of the response is null or a "
117117
+ "negative value:"
118118
+ networkMetric.getTimeToResponseInitiatedUs());
119119
return false;
120120
}
121121
if (!networkMetric.hasTimeToResponseCompletedUs()
122122
|| networkMetric.getTimeToResponseCompletedUs() <= 0) {
123-
logger.info(
123+
logger.warn(
124124
"Time from the start of the request to the end of the response is null, negative or "
125125
+ "zero:"
126126
+ networkMetric.getTimeToResponseCompletedUs());
127127
return false;
128128
}
129129
// Don't log any requests with a connection error set
130130
if (!networkMetric.hasHttpResponseCode()) {
131-
logger.info("Did not receive a HTTP Response Code");
131+
logger.warn("Did not receive a HTTP Response Code");
132132
return false;
133133
}
134134
return true;

firebase-perf/src/main/java/com/google/firebase/perf/util/URLAllowlist.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static boolean isURLAllowlisted(@NonNull URI uri, @NonNull Context appCon
3636
}
3737

3838
AndroidLogger.getInstance()
39-
.info("Detected domain allowlist, only allowlisted domains will be measured.");
39+
.debug("Detected domain allowlist, only allowlisted domains will be measured.");
4040
if (allowlistedDomains == null) {
4141
allowlistedDomains = resources.getStringArray(resourceId);
4242
}

0 commit comments

Comments
 (0)