From 7b0485f2cd36fb49be46e490e90cf588348469f5 Mon Sep 17 00:00:00 2001 From: nin0 Date: Sat, 3 May 2025 08:46:46 -0400 Subject: [PATCH] add extra logging --- src/grokCookies.ts | 7 ++++++- src/index.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/grokCookies.ts b/src/grokCookies.ts index 23324ae..6026aef 100644 --- a/src/grokCookies.ts +++ b/src/grokCookies.ts @@ -1,9 +1,12 @@ +import { fastify } from "."; import { state } from "./utils/state"; export async function getGrokAuthedCookies() { if (!process.env.FLARESOLVERR_BASE_URL) throw new Error("No flaresolverr found"); + fastify.log.info("Refreshing Grok meta"); + const req = await fetch( `${process.env.FLARESOLVERR_BASE_URL!.replace(/\/(v1)?$/, "")}/v1`, { @@ -22,7 +25,7 @@ export async function getGrokAuthedCookies() { if (!req.ok) throw new Error(await req.text()); const data = await req.json(); if (data.status !== "ok") { - console.error(data); + fastify.log.error(data); throw new Error(data); } @@ -41,4 +44,6 @@ export async function getGrokAuthedCookies() { requests: 3 } }; + + fastify.log.info("Refreshed Grok meta"); } diff --git a/src/index.ts b/src/index.ts index a38fce7..6125a89 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import Fastify from "fastify"; import { Yapper } from "./utils/Yapper"; import { getGrokAuthedCookies } from "./grokCookies"; -const fastify = Fastify({ +export const fastify = Fastify({ loggerInstance: new Yapper(), disableRequestLogging: true });