replace all the console logs with logger logs
This commit is contained in:
@ -15,14 +15,20 @@ import {
|
||||
import { signFeatureToken } from '../services/features'
|
||||
import { generateVerificationToken, OmnivoreAuthorizationHeader } from './auth'
|
||||
import { CreateTaskError } from './errors'
|
||||
import { buildLogger } from './logger'
|
||||
import { logger } from './logger'
|
||||
import View = google.cloud.tasks.v2.Task.View
|
||||
|
||||
const logger = buildLogger('app.dispatch')
|
||||
|
||||
// Instantiates a client.
|
||||
const client = new CloudTasksClient()
|
||||
|
||||
const logError = (error: Error): void => {
|
||||
if (axios.isAxiosError(error)) {
|
||||
logger.error(error.response)
|
||||
} else {
|
||||
logger.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
const createHttpTaskWithToken = async ({
|
||||
project = process.env.GOOGLE_CLOUD_PROJECT,
|
||||
queue = env.queue.name,
|
||||
@ -245,8 +251,8 @@ export const enqueueParseRequest = async ({
|
||||
// Calling the handler function directly.
|
||||
setTimeout(() => {
|
||||
axios.post(env.queue.contentFetchUrl, payload).catch((error) => {
|
||||
console.error(error)
|
||||
console.error(
|
||||
logError(error)
|
||||
logger.warning(
|
||||
`Error occurred while requesting local puppeteer-parse function\nPlease, ensure your function is set up properly and running using "yarn start" from the "/pkg/gcf/puppeteer-parse" folder`
|
||||
)
|
||||
})
|
||||
@ -399,7 +405,7 @@ export const enqueueTextToSpeech = async ({
|
||||
// Calling the handler function directly.
|
||||
setTimeout(() => {
|
||||
axios.post(taskHandlerUrl, payload).catch((error) => {
|
||||
console.error(error)
|
||||
logError(error)
|
||||
})
|
||||
}, 0)
|
||||
return ''
|
||||
@ -450,7 +456,7 @@ export const enqueueRecommendation = async (
|
||||
headers,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
logError(error)
|
||||
})
|
||||
}, 0)
|
||||
return ''
|
||||
@ -494,7 +500,7 @@ export const enqueueImportFromIntegration = async (
|
||||
headers,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
logError(error)
|
||||
})
|
||||
}, 0)
|
||||
return nanoid()
|
||||
@ -543,7 +549,7 @@ export const enqueueThumbnailTask = async (
|
||||
headers,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
logError(error)
|
||||
})
|
||||
}, 0)
|
||||
return ''
|
||||
@ -590,7 +596,7 @@ export const enqueueRssFeedFetch = async (
|
||||
headers,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
logError(error)
|
||||
})
|
||||
}, 0)
|
||||
return nanoid()
|
||||
|
||||
Reference in New Issue
Block a user