From 303effe849d4c6541b4b5e299326d2f2b233bb65 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Thu, 15 Sep 2022 10:44:25 +0800 Subject: [PATCH] Log request body only in tts cloud functions --- packages/text-to-speech/src/htmlToSsml.ts | 6 +++--- packages/text-to-speech/src/index.ts | 4 ++-- packages/text-to-speech/src/textToSpeech.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/text-to-speech/src/htmlToSsml.ts b/packages/text-to-speech/src/htmlToSsml.ts index 9999e9f24..d506f1432 100644 --- a/packages/text-to-speech/src/htmlToSsml.ts +++ b/packages/text-to-speech/src/htmlToSsml.ts @@ -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') diff --git a/packages/text-to-speech/src/index.ts b/packages/text-to-speech/src/index.ts index 63f9a6631..643148ce9 100644 --- a/packages/text-to-speech/src/index.ts +++ b/packages/text-to-speech/src/index.ts @@ -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' }) diff --git a/packages/text-to-speech/src/textToSpeech.ts b/packages/text-to-speech/src/textToSpeech.ts index 05df7807b..2d590bc0e 100644 --- a/packages/text-to-speech/src/textToSpeech.ts +++ b/packages/text-to-speech/src/textToSpeech.ts @@ -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') } }