Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix db logger not logging

ammarahm-ed3e95e0feaeaf
diff --git a/apps/mobile/app/common/database/index.js b/apps/mobile/app/common/database/index.js
index cdf7c9997..f4a75ad62 100644
--- a/apps/mobile/app/common/database/index.js
+++ b/apps/mobile/app/common/database/index.js
@@ -17,18 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { database } from "@notesnook/common";
-import { initalize, logger as dbLogger } from "@notesnook/core/dist/logger";
+import { logger as dbLogger } from "@notesnook/core/dist/logger";
import { Platform } from "react-native";
-import { MMKVLoader } from "react-native-mmkv-storage";
-import filesystem from "../filesystem";
+import * as Gzip from "react-native-gzip";
import EventSource from "../../utils/sse/even-source-ios";
import AndroidEventSource from "../../utils/sse/event-source";
-import Storage, { KV } from "./storage";
-import * as Gzip from "react-native-gzip";
-
-const LoggerStorage = new MMKVLoader()
- .withInstanceID("notesnook_logs")
- .initialize();
+import filesystem from "../filesystem";
+import "./logger";
+import Storage from "./storage";
database.host(
__DEV__
@@ -63,7 +59,5 @@ database.setup(
}
);
-initalize(new KV(LoggerStorage));
-
export const db = database;
export const DatabaseLogger = dbLogger;
diff --git a/apps/mobile/app/common/database/logger.js b/apps/mobile/app/common/database/logger.js
new file mode 100644
index 000000000..a9c1876a1
--- /dev/null
+++ b/apps/mobile/app/common/database/logger.js
@@ -0,0 +1,29 @@
+/*
+This file is part of the Notesnook project (https://notesnook.com/)
+
+Copyright (C) 2023 Streetwriters (Private) Limited
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+import { MMKVLoader } from "react-native-mmkv-storage";
+import { initalize } from "@notesnook/core/dist/logger";
+import { KV } from "./storage";
+
+const LoggerStorage = new MMKVLoader()
+ .withInstanceID("notesnook_logs")
+ .initialize();
+
+initalize(new KV(LoggerStorage));
+
+export {};