import { createLogger } from "@shared/common/logging";
import { isHttpError } from "@shared/common/async_utils";
import { HTTPError } from "got/dist/source";

export const logger = createLogger({
    errorHandler: (reason) => {
        if (isHttpError<HTTPError>(reason)) {
            return new Error(`HTTPError: ${reason.request.requestUrl} failed because ${reason}\nStack trace: ${reason.stack}`);
        }
        return undefined;
    },
});
