Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pacmak): add 'silly' loglevel for command output #3125

Merged
merged 3 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/jsii-pacmak/lib/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ export enum Level {
QUIET = 0,
INFO = 1,
VERBOSE = 2,
SILLY = 3,
}

export const LEVEL_INFO: number = Level.INFO;
export const LEVEL_VERBOSE: number = Level.VERBOSE;
export const LEVEL_SILLY: number = Level.SILLY;

/** The minimal logging level for messages to be emitted. */
export let level = Level.QUIET;
Expand Down
1 change: 0 additions & 1 deletion packages/jsii-pacmak/lib/packaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export class JsiiModule {
*/
public async npmPack() {
this._tarball = await Scratch.make(async (tmpdir) => {
logging.debug(`Running "npm pack ${this.moduleDirectory}" in ${tmpdir}`);
// Quoting (JSON-stringifying) the module directory in order to avoid
// problems if there are spaces or other special characters in the path.
const args = ['pack', JSON.stringify(this.moduleDirectory)];
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ export async function shell(
const stdout = new Array<Buffer>();
const stderr = new Array<Buffer>();
child.stdout.on('data', (chunk) => {
if (logging.level >= logging.LEVEL_VERBOSE) {
if (logging.level >= logging.LEVEL_SILLY) {
process.stderr.write(chunk); // notice - we emit all build output to stderr
}
stdout.push(Buffer.from(chunk));
});
child.stderr.on('data', (chunk) => {
if (logging.level >= logging.LEVEL_VERBOSE) {
if (logging.level >= logging.LEVEL_SILLY) {
process.stderr.write(chunk);
}
stderr.push(Buffer.from(chunk));
Expand Down