feat: replace console with logger

This commit is contained in:
Zamitto 2024-12-23 09:17:47 -03:00
parent 59846cfe2f
commit c9be6b6b92
5 changed files with 6 additions and 10 deletions

View File

@ -89,7 +89,7 @@ const uploadSaveGame = async (
"Content-Type": "application/tar", "Content-Type": "application/tar",
}, },
onUploadProgress: (progressEvent) => { onUploadProgress: (progressEvent) => {
console.log(progressEvent); logger.log(progressEvent);
}, },
}); });

View File

@ -22,8 +22,6 @@ export class Aria2 {
], ],
{ stdio: "inherit", windowsHide: true } { stdio: "inherit", windowsHide: true }
); );
console.log(this.process);
} }
public static kill() { public static kill() {

View File

@ -1,5 +1,6 @@
import path from "node:path"; import path from "node:path";
import fs from "node:fs"; import fs from "node:fs";
import { logger } from "../logger";
export const calculateETA = ( export const calculateETA = (
totalLength: number, totalLength: number,
@ -33,7 +34,7 @@ export const getDirSize = async (dir: string): Promise<number> => {
return sizes.reduce((total, size) => total + size, 0); return sizes.reduce((total, size) => total + size, 0);
} catch (error) { } catch (error) {
console.error(error); logger.error(error);
return 0; return 0;
} }
}; };

View File

@ -6,6 +6,7 @@ import type {
TorBoxAddTorrentRequest, TorBoxAddTorrentRequest,
TorBoxRequestLinkRequest, TorBoxRequestLinkRequest,
} from "@types"; } from "@types";
import { logger } from "../logger";
export class TorBoxClient { export class TorBoxClient {
private static instance: AxiosInstance; private static instance: AxiosInstance;
@ -65,8 +66,8 @@ export class TorBoxClient {
); );
if (response.status !== 200) { if (response.status !== 200) {
console.error(response.data.error); logger.error(response.data.error);
console.error(response.data.detail); logger.error(response.data.detail);
return null; return null;
} }

View File

@ -43,8 +43,6 @@ export class PythonRPC {
} }
public static spawn(initialDownload?: StartDownloadPayload) { public static spawn(initialDownload?: StartDownloadPayload) {
console.log([this.BITTORRENT_PORT, this.RPC_PORT, this.RPC_PASSWORD]);
const commonArgs = [ const commonArgs = [
this.BITTORRENT_PORT, this.BITTORRENT_PORT,
this.RPC_PORT, this.RPC_PORT,
@ -86,8 +84,6 @@ export class PythonRPC {
"main.py" "main.py"
); );
console.log(scriptPath);
const childProcess = cp.spawn("python3", [scriptPath, ...commonArgs], { const childProcess = cp.spawn("python3", [scriptPath, ...commonArgs], {
stdio: ["inherit", "inherit"], stdio: ["inherit", "inherit"],
}); });