about summary refs log tree commit diff
path: root/src/state/persisted
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-11-26 15:44:30 -0600
committerGitHub <noreply@github.com>2023-11-26 13:44:30 -0800
commit08355e516632852540f44b089a0b31a3ffed802b (patch)
treec7ba3ec0874c6e5319f1fb9238660193e637d4c1 /src/state/persisted
parent4a592274592bf21855b0de23093ccc4e5bbc7a0b (diff)
downloadvoidsky-08355e516632852540f44b089a0b31a3ffed802b.tar.zst
Raise levels of some logs during pre-release (#1994)
Diffstat (limited to 'src/state/persisted')
-rw-r--r--src/state/persisted/index.ts5
-rw-r--r--src/state/persisted/legacy.ts10
2 files changed, 9 insertions, 6 deletions
diff --git a/src/state/persisted/index.ts b/src/state/persisted/index.ts
index f6eff4257..545fdc0e1 100644
--- a/src/state/persisted/index.ts
+++ b/src/state/persisted/index.ts
@@ -19,7 +19,7 @@ const _emitter = new EventEmitter()
  * the Provider.
  */
 export async function init() {
-  logger.debug('persisted state: initializing')
+  logger.info('persisted state: initializing')
 
   broadcast.onmessage = onBroadcastMessage
 
@@ -28,11 +28,12 @@ export async function init() {
     const stored = await store.read() // check for new store
     if (!stored) await store.write(defaults) // opt: init new store
     _state = stored || defaults // return new store
+    logger.log('persisted state: initialized')
   } catch (e) {
     logger.error('persisted state: failed to load root state from storage', {
       error: e,
     })
-    // AsyncStorage failured, but we can still continue in memory
+    // AsyncStorage failure, but we can still continue in memory
     return defaults
   }
 }
diff --git a/src/state/persisted/legacy.ts b/src/state/persisted/legacy.ts
index 655409aed..170401723 100644
--- a/src/state/persisted/legacy.ts
+++ b/src/state/persisted/legacy.ts
@@ -116,7 +116,7 @@ export function transform(legacy: Partial<LegacySchema>): Schema {
  * local storage AND old storage exists.
  */
 export async function migrate() {
-  logger.debug('persisted state: migrate')
+  logger.info('persisted state: migrate')
 
   try {
     const rawLegacyData = await AsyncStorage.getItem(
@@ -125,13 +125,15 @@ export async function migrate() {
     const alreadyMigrated = Boolean(await read())
 
     if (!alreadyMigrated && rawLegacyData) {
-      logger.debug('persisted state: migrating legacy storage')
+      logger.info('persisted state: migrating legacy storage')
       const legacyData = JSON.parse(rawLegacyData)
       const newData = transform(legacyData)
       await write(newData)
-      logger.debug('persisted state: migrated legacy storage')
+      // track successful migrations
+      logger.log('persisted state: migrated legacy storage')
     } else {
-      logger.debug('persisted state: no migration needed')
+      // track successful migrations
+      logger.log('persisted state: no migration needed')
     }
   } catch (e) {
     logger.error('persisted state: error migrating legacy storage', {