当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript logger.field函数代码示例

本文整理汇总了TypeScript中@coder/logger.field函数的典型用法代码示例。如果您正苦于以下问题:TypeScript field函数的具体用法?TypeScript field怎么用?TypeScript field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了field函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: field

			req.on("end", () => {
				const body = data.join("");
				fs.writeFileSync(fullPath, body);
				logger.debug("Wrote resource", field("path", fullPath), field("content-length", body.length));
				res.status(200);
				res.end();
			});
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:7,代码来源:server.ts

示例2: field

			return prom.then((result: CommandResult) => {
				if (result.exitCode != 0) {
					log.error("failed",
						field("exitCode", result.exitCode),
						field("stdout", result.stdout),
						field("stderr", result.stderr)
					);
				}

				return result;
			});
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:11,代码来源:runner.ts

示例3: resolve

const execute = (command: string, args: string[] = [], options: cp.SpawnOptions, logger: Logger): Promise<CommandResult> => {
	let resolve: (result: CommandResult) => void;
	const prom = new Promise<CommandResult>((res): void => {
		resolve = res;
	});

	const stdout: string[] = [];
	const stderr: string[] = [];
	const complete = (exitCode: number): void => {
		resolve({
			stderr: stderr.join(""),
			stdout: stdout.join(""),
			exitCode,
		});
	};
	logger.info(`Executing '${command} ${JSON.stringify(args)}'`, field("options", options));
	const proc = cp.spawn(command, args.length > 0 ? args : [], options);
	proc.on("close", (code) => {
		complete(code);
	});
	proc.on("exit", (code) => {
		complete(code!);
	});
	proc.stdout.on("data", (d) => {
		stdout.push(d.toString());
		logger.debug("stdio", field("stdout", d.toString()));
	});
	proc.stderr.on("data", (d) => {
		stderr.push(d.toString());
		logger.debug("stdio", field("stderr", d.toString()));
	});

	return prom;
};
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:34,代码来源:runner.ts

示例4: parseCookies

	const isAuthed = (req: http.IncomingMessage): boolean => {
		try {
			if (!options.password || options.bypassAuth) {
				return true;
			}

			// Try/catch placed here just in case
			const cookies = parseCookies(req);
			if (cookies.password && safeCompare(cookies.password, options.password)) {
				return true;
			}
		} catch (ex) {
			logger.error("Failed to parse cookies", field("error", ex));
		}

		return false;
	};
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:17,代码来源:server.ts

示例5: field

				logger.trace(() => [
					`emit ${event}`,
					field("id", message.getId()),
					field("args", args.map((a) => stringify(a))),
				]);
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:5,代码来源:evaluate.ts

示例6: clearTimeout

		prom.then(() => {
			if (outputTimer) {
				clearTimeout(outputTimer);
			}
			log.info("Completed!", field("time", timer));
		}).catch((ex) => {
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:6,代码来源:runner.ts


注:本文中的@coder/logger.field函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。