diff --git a/src/core/archive.ts b/src/core/archive.ts index 219cbf9..7b86ffd 100644 --- a/src/core/archive.ts +++ b/src/core/archive.ts @@ -549,6 +549,8 @@ class ArchiveDownloader extends Downloader { this.allDownloadTasks = previousTask.allDownloadTasks; this.downloadTasks = previousTask.downloadTasks; this.finishedFilenames = previousTask.finishedFilenames; + + logger.setDebugMode(this.verbose); if (this.headers && Object.keys(this.headers).length > 0) { // Apply global custom headers axios.defaults.headers.common = { diff --git a/src/index.ts b/src/index.ts index 98c126e..0f1765c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,7 +53,7 @@ Erii.bind( async (ctx, options) => { const path = ctx.getArgument().toString(); if (options.verbose) { - logger.enableDebugMode(); + logger.setDebugMode(true); } if (!options.noProxy && !process.env.NO_PROXY) { if (process.platform === "win32") { @@ -125,7 +125,7 @@ Erii.bind( }, (ctx, options) => { if (options.verbose) { - logger.enableDebugMode(); + logger.setDebugMode(true); } const fileOptions = readConfigFile(); if (Object.keys(fileOptions).length > 0) { diff --git a/src/utils/log.ts b/src/utils/log.ts index a179eeb..c66e6e2 100644 --- a/src/utils/log.ts +++ b/src/utils/log.ts @@ -21,8 +21,12 @@ class ConsoleLogger { console.info(chalk.red(`[MINYAMI][ERROR] ${message}`)); } - enableDebugMode() { - this.isDebugMode = true; + setDebugMode(enabled: boolean): void { + this.isDebugMode = enabled; + } + + isDebugEnabled(): boolean { + return this.isDebugMode; } } diff --git a/src/utils/system.ts b/src/utils/system.ts index b89a19c..793d93e 100644 --- a/src/utils/system.ts +++ b/src/utils/system.ts @@ -6,7 +6,7 @@ import logger from "./log"; export const exec = util.promisify(require("child_process").exec); -export const sleep = (deley) => new Promise((resolve) => setTimeout(resolve, deley)); +export const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)); export const deleteDirectory = (directoryPath: string, fileList: string[] = []) => { for (const filename of fileList) {