mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
Update AbsLogger to have a tag with logs
This commit is contained in:
parent
88e1877742
commit
fe921fd5b1
11 changed files with 69 additions and 63 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue