Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public constructor () {
const stringifiedDebugModuleFilter = processenv('LOG_DEBUG_MODULE_FILTER', '');
if (typeof stringifiedDebugModuleFilter !== 'string') {
throw new Error('Debug module filter invalid.');
}
const debugModuleFilter = stringifiedDebugModuleFilter.
split(',').
filter((item: string): boolean => Boolean(item));
let formatter = process.stdout.isTTY ? asHumanReadable : asJson;
const formatterOverride = processenv('LOG_FORMATTER');
if (formatterOverride) {
formatter = formatterOverride === 'human' ? asHumanReadable : asJson;
}
throw new Error('Debug module filter invalid.');
}
const debugModuleFilter = stringifiedDebugModuleFilter.
split(',').
filter((item: string): boolean => Boolean(item));
let formatter = process.stdout.isTTY ? asHumanReadable : asJson;
const formatterOverride = processenv('LOG_FORMATTER');
if (formatterOverride) {
formatter = formatterOverride === 'human' ? asHumanReadable : asJson;
}
const logLevel = processenv('LOG_LEVEL', 'info');
if (!isLogLevel(logLevel)) {
throw new Error(`Log level '${logLevel}' unknown.`);
}
const highestEnabledLogLevel = logLevel;
const hostname = os.hostname();
const logEntryIdGenerator = getLogEntryIdGenerator();
this.configuration = new Configuration(
debugModuleFilter,
formatter,
highestEnabledLogLevel,
hostname,
public constructor () {
const stringifiedDebugModuleFilter = processenv('LOG_DEBUG_MODULE_FILTER', '');
if (typeof stringifiedDebugModuleFilter !== 'string') {
throw new Error('Debug module filter invalid.');
}
const debugModuleFilter = stringifiedDebugModuleFilter.
split(',').
filter((item: string): boolean => Boolean(item));
let formatter = process.stdout.isTTY ? asHumanReadable : asJson;
const formatterOverride = processenv('LOG_FORMATTER');
if (formatterOverride) {
formatter = formatterOverride === 'human' ? asHumanReadable : asJson;
}
const logLevel = processenv('LOG_LEVEL', 'info');
if (!isLogLevel(logLevel)) {
throw new Error(`Log level '${logLevel}' unknown.`);
}
const highestEnabledLogLevel = logLevel;
const hostname = os.hostname();
const logEntryIdGenerator = getLogEntryIdGenerator();
const runCommand = async function (command, options = {}) {
if (!command) {
throw new Error('Command is missing.');
}
const cwd = options.cwd || process.cwd(),
env = options.env || processenv(),
maxBuffer = options.maxBuffer || 1024 * 200,
silent = options.silent || false;
return new Promise((resolve, reject) => {
try {
const childProcess = shell.exec(command, { cwd, env, maxBuffer, silent: true }, (exitCode, stdout, stderr) => {
if (exitCode !== 0) {
const ex = new errors.ExecutableFailed(stderr);
ex.command = command;
ex.exitCode = exitCode;
ex.stdout = stdout;
ex.stderr = stderr;
return reject(ex);
}