add extra logging

This commit is contained in:
nin0 2025-05-03 08:46:46 -04:00
parent 73dbf48c44
commit 7b0485f2cd
Signed by: nin0
SSH key fingerprint: SHA256:NOoDnFVvZNFvqfXCIhzr6oCTDImZAbTTuyAysZ8Ufk8
2 changed files with 7 additions and 2 deletions

View file

@ -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");
}

View file

@ -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
});