Add duration in logging

This commit is contained in:
Hongbo Wu 2022-08-17 11:03:11 +08:00
parent b0bf4fc5ce
commit c482ad320b

View file

@ -82,6 +82,7 @@ export function articleRouter() {
}
const { uid } = jwt.decode(token) as Claims
const startTime = Date.now()
logger.info('Get article speech in mp3 format', {
params: req.params,
labels: {
@ -125,7 +126,10 @@ export function articleRouter() {
user: { id: uid },
})
logger.info('Found speech mp3', { audioUrl: speech.audioUrl })
logger.info('Found speech mp3', {
audioUrl: speech.audioUrl,
duration: Date.now() - startTime,
})
res.redirect(speech.audioUrl)
}
)