Setup onLog event, add app version & platform to logs and share filename

This commit is contained in:
advplyr
2025-04-20 14:33:48 -05:00
parent fe921fd5b1
commit 26b0fae0fb
6 changed files with 61 additions and 9 deletions
+8 -2
View File
@@ -8,15 +8,18 @@ class AbsLoggerWeb extends WebPlugin {
}
saveLog(level, tag, message) {
this.logs.push({
const log = {
id: Math.random().toString(36).substring(2, 15),
tag: tag,
timestamp: Date.now(),
level: level,
message: message
})
}
this.logs.push(log)
this.notifyListeners('onLog', log)
}
// PluginMethod
async info(data) {
if (data?.message) {
this.saveLog('info', data.tag || '', data.message)
@@ -24,6 +27,7 @@ class AbsLoggerWeb extends WebPlugin {
}
}
// PluginMethod
async error(data) {
if (data?.message) {
this.saveLog('error', data.tag || '', data.message)
@@ -31,12 +35,14 @@ class AbsLoggerWeb extends WebPlugin {
}
}
// PluginMethod
async getAllLogs() {
return {
value: this.logs
}
}
// PluginMethod
async clearLogs() {
this.logs = []
}