You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
575 B
19 lines
575 B
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`); |
|
};
|
|
|