Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
20 lines
575 B
JavaScript
20 lines
575 B
JavaScript
import {debuglog} from 'node:util';
|
|
import process from 'node:process';
|
|
|
|
export const verboseDefault = debuglog('execa').enabled;
|
|
|
|
const padField = (field, padding) => String(field).padStart(padding, '0');
|
|
|
|
const getTimestamp = () => {
|
|
const date = new Date();
|
|
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
};
|
|
|
|
export const logCommand = (escapedCommand, {verbose}) => {
|
|
if (!verbose) {
|
|
return;
|
|
}
|
|
|
|
process.stderr.write(`[${getTimestamp()}] ${escapedCommand}\n`);
|
|
};
|