Update:Logs to use server local timezone instead of UTC #656

This commit is contained in:
advplyr 2022-06-18 11:34:28 -05:00
parent 91e30a6e84
commit fd13607d89
4 changed files with 12 additions and 12 deletions

View File

@ -17,8 +17,8 @@
<div ref="container" class="relative w-full h-full bg-primary border-bg overflow-x-hidden overflow-y-auto text-red shadow-inner rounded-md" style="max-height: 550px; min-height: 550px">
<template v-for="(log, index) in logs">
<div :key="index" class="flex flex-nowrap px-2 py-1 items-start text-sm bg-opacity-10" :class="`bg-${logColors[log.level]}`">
<p class="text-gray-400 w-40 font-mono">{{ log.timestamp.split('.')[0].split('T').join(' ') }}</p>
<p class="font-semibold w-12 text-right" :class="`text-${logColors[log.level]}`">{{ log.levelName }}</p>
<p class="text-gray-400 w-36 font-mono text-xs">{{ log.timestamp }}</p>
<p class="font-semibold w-12 text-right text-sm" :class="`text-${logColors[log.level]}`">{{ log.levelName }}</p>
<p class="px-4 logmessage">{{ log.message }}</p>
</div>
</template>

6
package-lock.json generated
View File

@ -5,14 +5,14 @@
"requires": true,
"packages": {
"": {
"version": "2.0.20",
"version": "2.0.21",
"license": "GPL-3.0",
"dependencies": {
"archiver": "^5.3.0",
"axios": "^0.26.1",
"bcryptjs": "^2.4.3",
"command-line-args": "^5.2.0",
"date-and-time": "^2.0.1",
"date-and-time": "^2.3.1",
"express": "^4.17.1",
"express-fileupload": "^1.2.1",
"express-rate-limit": "^5.3.0",
@ -3381,4 +3381,4 @@
}
}
}
}
}

View File

@ -11,9 +11,9 @@
"build-win": "npm run client && pkg -t node16-win-x64 -o ./dist/win/audiobookshelf -C GZip .",
"build-linux": "build/linuxpackager",
"docker": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push . -t advplyr/audiobookshelf",
"docker-amd64-local":"docker buildx build --platform linux/amd64 --load . -t advplyr/audiobookshelf-amd64-local",
"docker-arm64-local":"docker buildx build --platform linux/arm64 --load . -t advplyr/audiobookshelf-arm64-local",
"docker-armv7-local":"docker buildx build --platform linux/arm/v7 --load . -t advplyr/audiobookshelf-armv7-local",
"docker-amd64-local": "docker buildx build --platform linux/amd64 --load . -t advplyr/audiobookshelf-amd64-local",
"docker-arm64-local": "docker buildx build --platform linux/arm64 --load . -t advplyr/audiobookshelf-arm64-local",
"docker-armv7-local": "docker buildx build --platform linux/arm/v7 --load . -t advplyr/audiobookshelf-armv7-local",
"deploy": "node dist/autodeploy"
},
"bin": "prod.js",
@ -34,7 +34,7 @@
"axios": "^0.26.1",
"bcryptjs": "^2.4.3",
"command-line-args": "^5.2.0",
"date-and-time": "^2.0.1",
"date-and-time": "^2.3.1",
"express": "^4.17.1",
"express-fileupload": "^1.2.1",
"express-rate-limit": "^5.3.0",
@ -49,4 +49,4 @@
"socket.io": "^4.4.1",
"xml2js": "^0.4.23"
}
}
}

View File

@ -1,16 +1,16 @@
const date = require('date-and-time')
const { LogLevel } = require('./utils/constants')
class Logger {
constructor() {
this.logLevel = process.env.NODE_ENV === 'production' ? LogLevel.INFO : LogLevel.TRACE
// this.logFileLevel = LogLevel.INFO
this.socketListeners = []
this.logManager = null
}
get timestamp() {
return (new Date()).toISOString()
return date.format(new Date(), 'YYYY-MM-DD HH:mm:ss')
}
get levelString() {