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


TypeScript logger.error方法代码示例

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


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

示例1: catch

			send: (data): void => {
				if (ws.readyState !== ws.OPEN) {
					return;
				}
				try {
					ws.send(data);
				} catch (error) {
					logger.error(error.message);
				}
			},
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:10,代码来源:server.ts

示例2: prompt

	public prompt(severity: Severity, message: string, _buttons: INotificationButton[], _onCancel: () => void): INotificationHandle {
		switch (severity) {
			case Severity.Info: logger.info(message); break;
			case Severity.Warning: logger.warn(message); break;
			case Severity.Error: logger.error(message); break;
		}

		return {
			close: (): void => undefined,
			updateMessage: (): void => undefined,
			updateButtons: (): void => undefined,
		};
	}
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:13,代码来源:notification.ts

示例3: 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

示例4: field

export const run = (name: string = process.argv[2]): void | Promise<void> => {
	const task = tasks.get(name);
	if (!task) {
		logger.error("Task not found.", field("name", name), field("available", Array.from(tasks.keys())));

		return process.exit(1);
	}
	if (activated.has(name)) {
		return activated.get(name);
	}
	let cwd: string = process.cwd();
	const log = logger.named(name);
	const timer = time(Number.MAX_SAFE_INTEGER);
	let outputTimer: NodeJS.Timer | undefined;
	log.info("Starting...");
	const prom = task.func({
		set cwd(path: string) {
			cwd = path;
		},
		execute(command: string, args: string[] = [], env?: object): Promise<CommandResult> {
			const prom = execute(command, args, {
				cwd,
				env: env as NodeJS.ProcessEnv,
			}, log);

			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;
			});
		},
	}, ...process.argv.slice(3));

	if (prom) {
		activated.set(name, prom);

		const doOutput = (): void => {
			outputTimer = setTimeout(() => {
				log.info("Still running...");
				doOutput();
			}, 60 * 1000 * 5);
		};
		doOutput();

		prom.then(() => {
			if (outputTimer) {
				clearTimeout(outputTimer);
			}
			log.info("Completed!", field("time", timer));
		}).catch((ex) => {
			activated.delete(name);
			log.error(`Failed: ${ex.message}`);
			log.error(`Stack: ${ex.stack}`);

			return process.exit(1);
		});
	}

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

示例5: error

	public error(error: Error): void {
		logger.error(error.message, field("error", error));
	}
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:3,代码来源:notification.ts


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