cordova-plugin-unvired-logger 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/Logger.java +2 -2
- package/src/browser/Logger.js +14 -14
- package/src/electron/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-unvired-logger",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "A logger plugin for Electron, Android, Browser, and iOS that appends logs to log.txt files organized by user ID.",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "cordova-plugin-unvired-logger",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<plugin id="cordova-plugin-unvired-logger" version="0.0.
|
|
2
|
+
<plugin id="cordova-plugin-unvired-logger" version="0.0.23"
|
|
3
3
|
xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
4
4
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
5
5
|
|
package/src/android/Logger.java
CHANGED
|
@@ -22,9 +22,9 @@ public class Logger extends CordovaPlugin {
|
|
|
22
22
|
private static final long MAX_LOG_SIZE = 50 * 1024 * 1024; // 50MB
|
|
23
23
|
|
|
24
24
|
// LogLevel constants as int
|
|
25
|
-
private static final int LOG_LEVEL_DEBUG =
|
|
25
|
+
private static final int LOG_LEVEL_DEBUG = 9;
|
|
26
26
|
private static final int LOG_LEVEL_ERROR = 8;
|
|
27
|
-
private static final int LOG_LEVEL_INFO =
|
|
27
|
+
private static final int LOG_LEVEL_INFO = 7;
|
|
28
28
|
|
|
29
29
|
private int defaultLogLevel = LOG_LEVEL_INFO;
|
|
30
30
|
|
package/src/browser/Logger.js
CHANGED
|
@@ -3,9 +3,9 @@ const BACKUP_LOG_FILE_NAME = 'log_backup.txt';
|
|
|
3
3
|
const MAX_LOG_SIZE = 50 * 1024 * 1024; // 50MB
|
|
4
4
|
|
|
5
5
|
const LogLevel = {
|
|
6
|
-
Debug:
|
|
6
|
+
Debug: 9,
|
|
7
7
|
Error: 8,
|
|
8
|
-
Info:
|
|
8
|
+
Info: 7,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
let defaultLogLevel = LogLevel.Info; // Now an int
|
|
@@ -150,19 +150,19 @@ async function logWitLevel(successCallback, errorCallback, args) {
|
|
|
150
150
|
// Log to console for browser debugging
|
|
151
151
|
console.log(data);
|
|
152
152
|
|
|
153
|
-
// Store in localStorage
|
|
154
|
-
const storageKey = getStorageKey(userId, LOG_FILE_NAME);
|
|
155
|
-
const existingContent = localStorage.getItem(storageKey) || '';
|
|
156
|
-
const newContent = existingContent + data;
|
|
153
|
+
// // Store in localStorage
|
|
154
|
+
// const storageKey = getStorageKey(userId, LOG_FILE_NAME);
|
|
155
|
+
// const existingContent = localStorage.getItem(storageKey) || '';
|
|
156
|
+
// const newContent = existingContent + data;
|
|
157
157
|
|
|
158
|
-
// Check size limit
|
|
159
|
-
if (newContent.length > MAX_LOG_SIZE) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
} else {
|
|
164
|
-
|
|
165
|
-
}
|
|
158
|
+
// // Check size limit
|
|
159
|
+
// if (newContent.length > MAX_LOG_SIZE) {
|
|
160
|
+
// // If content is too large, truncate it
|
|
161
|
+
// const truncatedContent = newContent.substring(newContent.length - MAX_LOG_SIZE / 2);
|
|
162
|
+
// localStorage.setItem(storageKey, truncatedContent);
|
|
163
|
+
// } else {
|
|
164
|
+
// localStorage.setItem(storageKey, newContent);
|
|
165
|
+
// }
|
|
166
166
|
|
|
167
167
|
successCallback(`Logged to browser storage: ${storageKey}`);
|
|
168
168
|
} catch (err) {
|