Skip to content

Commit 1c756ee

Browse files
committed
Add logging to try to catch error.
1 parent a00351d commit 1c756ee

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

firebase-common/src/main/java/com/google/firebase/datastore/DataStore.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.firebase.datastore
1818

1919
import android.content.Context
20+
import android.util.Log
2021
import androidx.datastore.core.DataStore
2122
import androidx.datastore.preferences.SharedPreferencesMigration
2223
import androidx.datastore.preferences.core.MutablePreferences
@@ -56,6 +57,13 @@ class DataStorage(val context: Context, val name: String) {
5657
produceMigrations = { listOf(SharedPreferencesMigration(it, name)) }
5758
)
5859

60+
init {
61+
Log.i(
62+
"DataStorage",
63+
"Datastore instance created for context $context (${context.packageName}) with name $name"
64+
)
65+
}
66+
5967
private val dataStore = context.dataStore
6068

6169
/**

firebase-common/src/main/java/com/google/firebase/heartbeatinfo/HeartBeatInfoStorage.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import android.content.Context;
1818
import android.os.Build;
19+
import android.util.Log;
1920
import androidx.annotation.RestrictTo;
2021
import androidx.annotation.VisibleForTesting;
2122
import androidx.datastore.preferences.core.*;
@@ -61,13 +62,19 @@ class HeartBeatInfoStorage {
6162
private final DataStorage firebaseDataStore;
6263

6364
public HeartBeatInfoStorage(Context applicationContext, String persistenceKey) {
65+
Log.i(
66+
"DataStorage",
67+
String.format(
68+
"Creating a DataStorage instance for context %s (%s) with name %s",
69+
applicationContext, applicationContext.getPackageName(), persistenceKey));
6470
this.firebaseDataStore =
6571
new DataStorage(applicationContext, HEARTBEAT_PREFERENCES_NAME + persistenceKey);
6672
}
6773

6874
@VisibleForTesting
6975
@RestrictTo(RestrictTo.Scope.TESTS)
7076
HeartBeatInfoStorage(DataStorage dataStorage) {
77+
Log.i("DataStorage", "New test storage created");
7178
this.firebaseDataStore = dataStorage;
7279
}
7380

0 commit comments

Comments
 (0)