當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。