fix(gotransport): error handling so we dont get spammed with errors
This commit is contained in:
@@ -2,6 +2,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
import axios from "axios";
|
||||
import { pino } from "pino";
|
||||
import build from "pino-abstract-transport";
|
||||
import { tryCatch } from "../../globalUtils/tryCatch.js";
|
||||
|
||||
const pinoLogLevels: any = {
|
||||
10: "trace",
|
||||
@@ -26,12 +27,19 @@ export default async function buildGoTransport() {
|
||||
// service: obj?.service.toLowerCase(),
|
||||
// message: obj.msg,
|
||||
// });
|
||||
|
||||
const { data, error } = (await tryCatch(
|
||||
axios.post(`${process.env.LST_BASE_URL}/api/v1/log`, {
|
||||
service: obj?.service.toLowerCase(),
|
||||
level: levelName,
|
||||
message: obj.msg,
|
||||
});
|
||||
})
|
||||
)) as any;
|
||||
|
||||
if (error) {
|
||||
console.log(
|
||||
"The go server must be offline so we cant post the new logs."
|
||||
);
|
||||
}
|
||||
|
||||
// console.log(`Go log level: ${levelName}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user