add extra logging
This commit is contained in:
parent
73dbf48c44
commit
7b0485f2cd
2 changed files with 7 additions and 2 deletions
|
@ -1,9 +1,12 @@
|
||||||
|
import { fastify } from ".";
|
||||||
import { state } from "./utils/state";
|
import { state } from "./utils/state";
|
||||||
|
|
||||||
export async function getGrokAuthedCookies() {
|
export async function getGrokAuthedCookies() {
|
||||||
if (!process.env.FLARESOLVERR_BASE_URL)
|
if (!process.env.FLARESOLVERR_BASE_URL)
|
||||||
throw new Error("No flaresolverr found");
|
throw new Error("No flaresolverr found");
|
||||||
|
|
||||||
|
fastify.log.info("Refreshing Grok meta");
|
||||||
|
|
||||||
const req = await fetch(
|
const req = await fetch(
|
||||||
`${process.env.FLARESOLVERR_BASE_URL!.replace(/\/(v1)?$/, "")}/v1`,
|
`${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());
|
if (!req.ok) throw new Error(await req.text());
|
||||||
const data = await req.json();
|
const data = await req.json();
|
||||||
if (data.status !== "ok") {
|
if (data.status !== "ok") {
|
||||||
console.error(data);
|
fastify.log.error(data);
|
||||||
throw new Error(data);
|
throw new Error(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,4 +44,6 @@ export async function getGrokAuthedCookies() {
|
||||||
requests: 3
|
requests: 3
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fastify.log.info("Refreshed Grok meta");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Fastify from "fastify";
|
||||||
import { Yapper } from "./utils/Yapper";
|
import { Yapper } from "./utils/Yapper";
|
||||||
import { getGrokAuthedCookies } from "./grokCookies";
|
import { getGrokAuthedCookies } from "./grokCookies";
|
||||||
|
|
||||||
const fastify = Fastify({
|
export const fastify = Fastify({
|
||||||
loggerInstance: new Yapper(),
|
loggerInstance: new Yapper(),
|
||||||
disableRequestLogging: true
|
disableRequestLogging: true
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue