本文整理汇总了TypeScript中winston.LoggerInstance.error方法的典型用法代码示例。如果您正苦于以下问题:TypeScript LoggerInstance.error方法的具体用法?TypeScript LoggerInstance.error怎么用?TypeScript LoggerInstance.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类winston.LoggerInstance
的用法示例。
在下文中一共展示了LoggerInstance.error方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: catch
this.redisClient.brpoplpush('incoming', 'working', 0).then((jobMessage: string) => {
this.logger.debug(`Message received from Redis server: ${jobMessage}`);
try {
this.ocrProcessingService.process(jobMessage);
} catch (e) {
this.logger.error(`${e.message}: ${e.stack}`);
}
this.redisClient.lrem('working', 1, jobMessage).then(() => { this.loop(); });
});
示例2: generalErrorHandler
export function generalErrorHandler(err: any, req: Request, res: Response, next: express.NextFunction) {
let message = `Error
method: ${ req.method }
path: ${ req.url }
payload: ${ JSON.stringify(req.body) }
`;
if (err instanceof Error) {
message += `message: ${ err.message }
stack: ${ err.stack }`;
} else {
message += `message: ${ err.toString() }`;
}
logger.error(message);
res.status(500).send({ status: 500, error: err.message || "Server error" });
}
示例3: process
public process(jobMessage: string): void {
this.logger.debug(`Starting Job: ${jobMessage}`);
const job: IJob = this.incomingJsonMessageToJobTf.transform(jobMessage);
this.logger.debug(`The sanitized and transformed job: ${JSON.stringify(job)}`);
try {
switch (job.type) {
case JobType.TESSERACT:
this.execTesseract(job);
break;
case JobType.OCRMYPDF:
this.execOcrMyPdf(job);
break;
}
} catch (e) {
this.logger.error(`Job errored: ${e.message}`);
this.finishJob(job, e);
}
this.finishJob(job);
}
示例4:
RedisClientFactory.redisInstance.on('error', (e: Error) => {
logger.error(`ERROR: ${e.message}.`);
});