Skip to content

Commit

Permalink
fix: update logger
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Jan 12, 2025
1 parent 6956046 commit b9daa90
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
20 changes: 11 additions & 9 deletions src/lib/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ export class LuaProjectLoader {
false,
true
);
console.log(
chalk.dim(
createFileTree([
...projectStructure.map((m) => m.path),
`${filePath} ${chalk.reset(chalk.bgGreen(" MAIN "))}`
])
)
);
console.log("");
if (!this.#logger.silent) {
console.log(
chalk.dim(
createFileTree([
...projectStructure.map((m) => m.path),
`${filePath} ${chalk.reset(chalk.bgGreen(" MAIN "))}`
])
)
);
console.log("");
}
}

return line.trim();
Expand Down
10 changes: 7 additions & 3 deletions src/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ export class Logger {
this.#silent = silent;
}

get silent() {
return this.#silent;
}

static #getInstance(name: string, silent: boolean = false): Logger {
if (!Logger.#instances.has(name)) {
Logger.#instances.set(name, new Logger(name, silent));
if (!Logger.#instances.has(`${name}-${silent}`)) {
Logger.#instances.set(`${name}-${silent}`, new Logger(name, silent));
}
return Logger.#instances.get(name)!;
return Logger.#instances.get(`${name}-${silent}`)!;
}

static init(name: string, silent: boolean = false) {
Expand Down

0 comments on commit b9daa90

Please sign in to comment.