本文整理汇总了TypeScript中vs/platform/log/common/log.ILogService.trace方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ILogService.trace方法的具体用法?TypeScript ILogService.trace怎么用?TypeScript ILogService.trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/platform/log/common/log.ILogService
的用法示例。
在下文中一共展示了ILogService.trace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getShellEnvironment
export function getShellEnvironment(logService: ILogService): Promise<typeof process.env> {
if (_shellEnv === undefined) {
if (isWindows) {
logService.trace('getShellEnvironment: runing on windows, skipping');
_shellEnv = Promise.resolve({});
} else if (process.env['VSCODE_CLI'] === '1') {
logService.trace('getShellEnvironment: runing on CLI, skipping');
_shellEnv = Promise.resolve({});
} else {
logService.trace('getShellEnvironment: running on Unix');
_shellEnv = getUnixShellEnvironment(logService);
}
}
return _shellEnv;
}
示例2: reject
child.on('close', code => {
if (code !== 0) {
return reject(new Error('Failed to get environment'));
}
const raw = Buffer.concat(buffers).toString('utf8');
logService.trace('getUnixShellEnvironment#raw', raw);
const match = regex.exec(raw);
const rawStripped = match ? match[1] : '{}';
try {
const env = JSON.parse(rawStripped);
if (runAsNode) {
env['ELECTRON_RUN_AS_NODE'] = runAsNode;
} else {
delete env['ELECTRON_RUN_AS_NODE'];
}
if (noAttach) {
env['ELECTRON_NO_ATTACH_CONSOLE'] = noAttach;
} else {
delete env['ELECTRON_NO_ATTACH_CONSOLE'];
}
// https://github.com/Microsoft/vscode/issues/22593#issuecomment-336050758
delete env['XDG_RUNTIME_DIR'];
logService.trace('getUnixShellEnvironment#result', env);
resolve(env);
} catch (err) {
logService.error('getUnixShellEnvironment#error', err);
reject(err);
}
});
示例3: generateUuid
const promise = new Promise<typeof process.env>((resolve, reject) => {
const runAsNode = process.env['ELECTRON_RUN_AS_NODE'];
logService.trace('getUnixShellEnvironment#runAsNode', runAsNode);
const noAttach = process.env['ELECTRON_NO_ATTACH_CONSOLE'];
logService.trace('getUnixShellEnvironment#noAttach', noAttach);
const mark = generateUuid().replace(/-/g, '').substr(0, 12);
const regex = new RegExp(mark + '(.*)' + mark);
const env = assign({}, process.env, {
ELECTRON_RUN_AS_NODE: '1',
ELECTRON_NO_ATTACH_CONSOLE: '1'
});
const command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
logService.trace('getUnixShellEnvironment#env', env);
logService.trace('getUnixShellEnvironment#spawn', command);
const child = cp.spawn(process.env.SHELL!, ['-ilc', command], {
detached: true,
stdio: ['ignore', 'pipe', process.stderr],
env
});
const buffers: Buffer[] = [];
child.on('error', () => resolve({}));
child.stdout.on('data', b => buffers.push(b));
child.on('close', code => {
if (code !== 0) {
return reject(new Error('Failed to get environment'));
}
const raw = Buffer.concat(buffers).toString('utf8');
logService.trace('getUnixShellEnvironment#raw', raw);
const match = regex.exec(raw);
const rawStripped = match ? match[1] : '{}';
try {
const env = JSON.parse(rawStripped);
if (runAsNode) {
env['ELECTRON_RUN_AS_NODE'] = runAsNode;
} else {
delete env['ELECTRON_RUN_AS_NODE'];
}
if (noAttach) {
env['ELECTRON_NO_ATTACH_CONSOLE'] = noAttach;
} else {
delete env['ELECTRON_NO_ATTACH_CONSOLE'];
}
// https://github.com/Microsoft/vscode/issues/22593#issuecomment-336050758
delete env['XDG_RUNTIME_DIR'];
logService.trace('getUnixShellEnvironment#result', env);
resolve(env);
} catch (err) {
logService.error('getUnixShellEnvironment#error', err);
reject(err);
}
});
});