mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-11 03:41:42 +00:00
Log actual object details when they appear in log arguments
This commit is contained in:
parent
68ef3a07a7
commit
fb73d95f19
1 changed files with 10 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ const Book = require('./Book')
|
||||||
const Podcast = require('./Podcast')
|
const Podcast = require('./Podcast')
|
||||||
|
|
||||||
const ShareManager = require('../managers/ShareManager')
|
const ShareManager = require('../managers/ShareManager')
|
||||||
|
const { LogLevel } = require('../utils/constants')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef LibraryFileObject
|
* @typedef LibraryFileObject
|
||||||
|
|
@ -301,8 +302,16 @@ class LibraryItem extends Model {
|
||||||
let existingValue = existingEpisodeMatch[key]
|
let existingValue = existingEpisodeMatch[key]
|
||||||
if (existingValue instanceof Date) existingValue = existingValue.valueOf()
|
if (existingValue instanceof Date) existingValue = existingValue.valueOf()
|
||||||
|
|
||||||
|
// Avoid `[object Object]` logs when troubleshooting.
|
||||||
|
let existingToLog = existingValue
|
||||||
|
let updatedToLog = updatedEpisodeCleaned[key]
|
||||||
|
if (Logger.logLevel <= LogLevel.DEBUG && typeof existingToLog === "object") {
|
||||||
|
existingToLog = JSON.stringify(existingToLog)
|
||||||
|
updatedToLog = JSON.stringify(updatedToLog)
|
||||||
|
}
|
||||||
|
|
||||||
if (!areEquivalent(updatedEpisodeCleaned[key], existingValue, true)) {
|
if (!areEquivalent(updatedEpisodeCleaned[key], existingValue, true)) {
|
||||||
Logger.debug(`[LibraryItem] "${libraryItemExpanded.media.title}" episode "${existingEpisodeMatch.title}" ${key} was updated from "${existingValue}" to "${updatedEpisodeCleaned[key]}"`)
|
Logger.debug(`[LibraryItem] "${libraryItemExpanded.media.title}" episode "${existingEpisodeMatch.title}" ${key} was updated from "${existingToLog}" to "${updatedToLog}"`)
|
||||||
episodeHasUpdates = true
|
episodeHasUpdates = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue