mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-23 11:11:04 +00:00
feat(packages/shared): add logger factory
- @revanced/websocket-api now also utilizes the new logger from the shared package - @revanced/websocket-api/utils/checkEnv has been renamed to its full form - It also no longer returns anything as it's no longer needed
This commit is contained in:
@@ -14,13 +14,8 @@ const parseImageEventHandler: EventHandler<ClientOperation.ParseImage> = async (
|
||||
d: { image_url: imageUrl, id },
|
||||
} = packet
|
||||
|
||||
logger.debug(
|
||||
`Client ${client.id} requested to parse image from URL:`,
|
||||
imageUrl,
|
||||
)
|
||||
logger.debug(
|
||||
`Queue currently has ${queue.remaining}/${config.ocrConcurrentQueues} items in it`,
|
||||
)
|
||||
logger.debug(`Client ${client.id} requested to parse image from URL:`, imageUrl)
|
||||
logger.debug(`Queue currently has ${queue.remaining}/${config.ocrConcurrentQueues} items in it`)
|
||||
|
||||
if (queue.remaining < config.ocrConcurrentQueues) queue.shift()
|
||||
await queue.wait()
|
||||
@@ -30,10 +25,7 @@ const parseImageEventHandler: EventHandler<ClientOperation.ParseImage> = async (
|
||||
|
||||
const { data, jobId } = await tesseractWorker.recognize(imageUrl)
|
||||
|
||||
logger.debug(
|
||||
`Recognized image from URL for client ${client.id} (job ${jobId}):`,
|
||||
data.text,
|
||||
)
|
||||
logger.debug(`Recognized image from URL for client ${client.id} (job ${jobId}):`, data.text)
|
||||
await client.send({
|
||||
op: ServerOperation.ParsedImage,
|
||||
d: {
|
||||
@@ -42,10 +34,7 @@ const parseImageEventHandler: EventHandler<ClientOperation.ParseImage> = async (
|
||||
},
|
||||
})
|
||||
} catch {
|
||||
logger.error(
|
||||
`Failed to parse image from URL for client ${client.id}:`,
|
||||
imageUrl,
|
||||
)
|
||||
logger.error(`Failed to parse image from URL for client ${client.id}:`, imageUrl)
|
||||
await client.send({
|
||||
op: ServerOperation.ParseImageFailed,
|
||||
d: {
|
||||
|
||||
Reference in New Issue
Block a user