Log request body only in tts cloud functions

This commit is contained in:
Hongbo Wu 2022-09-15 10:44:25 +08:00
parent 86ce1c1c7d
commit 303effe849
3 changed files with 7 additions and 7 deletions

View file

@ -75,7 +75,7 @@ const TOP_LEVEL_TAGS = [
function parseDomTree(pageNode: Element) {
if (!pageNode || pageNode.childNodes.length == 0) {
console.log(' no child nodes found')
console.log('no child nodes found')
return []
}
@ -282,7 +282,7 @@ const textToUtterance = ({
console.error('Unable to convert HTML to text', { text, err })
textWithWordOffset =
parseHTML(text).document.documentElement.textContent ?? text
console.debug('Converted HTML to text', { textWithWordOffset })
console.info('Converted HTML to text:', textWithWordOffset)
}
}
const wordCount = tokenizer.tokenize(textWithWordOffset).length
@ -297,7 +297,7 @@ const textToUtterance = ({
export const htmlToSpeechFile = (htmlInput: HtmlInput): SpeechFile => {
const { title, content, options } = htmlInput
console.debug('creating speech file with options', options)
console.log('creating speech file with options', options)
const dom = parseHTML(content)
const body = dom.document.querySelector('#readability-page-1')

View file

@ -75,7 +75,7 @@ const updateSpeech = async (
export const textToSpeechHandler = Sentry.GCPFunction.wrapHttpFunction(
async (req, res) => {
console.info('Text to speech request received')
console.info('Text to speech request body:', req.body)
const token = req.query.token as string
if (!process.env.JWT_SECRET) {
console.error('JWT_SECRET not exists')
@ -142,7 +142,7 @@ export const textToSpeechHandler = Sentry.GCPFunction.wrapHttpFunction(
export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
async (req, res) => {
console.debug('Text to speech steaming request', req)
console.log('Text to speech steaming request body:', req.body)
if (!process.env.JWT_SECRET) {
console.error('JWT_SECRET not exists')
return res.status(500).send({ errorCodes: 'JWT_SECRET_NOT_EXISTS' })

View file

@ -160,9 +160,9 @@ export const synthesizeTextToSpeech = async (
console.error('synthesis error', error)
throw error
} finally {
console.debug('closing synthesizer')
console.log('closing synthesizer')
audioStream?.end()
synthesizer.close()
console.debug('synthesizer closed')
console.log('synthesizer closed')
}
}