mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-12-05 14:26:31 +01:00
Update AbsLogger to have a tag with logs
This commit is contained in:
1 parent
88e1877742
commit
fe921fd5b1
11 files changed
+69
-63
No files matched your search
@@ -7,9 +7,10 @@ class AbsLoggerWeb extends WebPlugin {
|
||||
this.logs = []
|
||||
}
|
||||
|
||||
saveLog(level, message) {
|
||||
saveLog(level, tag, message) {
|
||||
this.logs.push({
|
||||
id: Math.random().toString(36).substring(2, 15),
|
||||
tag: tag,
|
||||
timestamp: Date.now(),
|
||||
level: level,
|
||||
message: message
|
||||
@@ -18,15 +19,15 @@ class AbsLoggerWeb extends WebPlugin {
|
||||
|
||||
async info(data) {
|
||||
if (data?.message) {
|
||||
this.saveLog('info', data.message)
|
||||
console.log('AbsLogger: info', data.message)
|
||||
this.saveLog('info', data.tag || '', data.message)
|
||||
console.log('AbsLogger: info', `[${data.tag || ''}]:`, data.message)
|
||||
}
|
||||
}
|
||||
|
||||
async error(data) {
|
||||
if (data?.message) {
|
||||
this.saveLog('error', data.message)
|
||||
console.error('AbsLogger: error', data.message)
|
||||
this.saveLog('error', data.tag || '', data.message)
|
||||
console.error('AbsLogger: error', `[${data.tag || ''}]:`, data.message)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user