permitir logear cosas de debug

This commit is contained in:
Cat /dev/Nulo 2023-02-09 21:38:00 -03:00
parent 92c82d5ad8
commit bd12d308d0
2 changed files with 15 additions and 8 deletions

View file

@ -12,6 +12,7 @@ import { Fstab } from "./fstab.js";
import { execFile } from "./helpers/better-api.js";
import { PasswdEntry, sudoReadPasswd } from "./helpers/passwd.js";
import { sudoWriteExecutable } from "./helpers/sudo.js";
import { logDebug } from "./helpers/logger.js";
export class Alpine {
dir: string;
@ -76,6 +77,8 @@ export class Alpine {
}
async addPackages(packages: string[]): Promise<void> {
logDebug(
"addPackages",
await execFile("sudo", [
"apk",
"add",
@ -83,7 +86,8 @@ export class Alpine {
"--root",
this.dir,
...packages,
]);
])
);
}
static async makeWorld({

3
helpers/logger.ts Normal file
View file

@ -0,0 +1,3 @@
export function logDebug(scope: string, message: any) {
if (process.argv.includes("-v")) console.debug(`[${scope}]`, message);
}