本文整理汇总了TypeScript中@toba/logger.log.error方法的典型用法代码示例。如果您正苦于以下问题:TypeScript log.error方法的具体用法?TypeScript log.error怎么用?TypeScript log.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@toba/logger.log
的用法示例。
在下文中一共展示了log.error方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: internalError
/**
* Render status `500` page.
*/
function internalError(res: Response, err?: Error): void {
if (is.value(err)) {
log.error(err);
}
res.statusCode = HttpStatus.InternalError;
res.render(Page.InternalError, { title: 'Oops', config });
}
示例2: compact
export function compact(text: string, options?: uglify.MinifyOptions): string {
const output = uglify.minify(text, options);
if (output.error) {
log.error(output.error);
return text;
} else {
return output.code;
}
}
示例3: reject
compress.gzip(Buffer.from(text), (err: Error, buffer: Buffer) => {
if (is.value(err)) {
reject(err);
log.error(err, { slug: key });
} else {
resolve({
buffer,
eTag: key + '_' + new Date().getTime().toString(),
type
});
}
});
示例4: postFeed
export function postFeed(req: Request, res: Response) {
if (!blog.postInfoLoaded) {
if (rssRetries >= MAX_RSS_RETRIES) {
log.error(`Unable to load blog after ${MAX_RSS_RETRIES} tries`);
view.notFound(req, res);
// reset tries so page can be refreshed
rssRetries = 0;
} else {
rssRetries++;
log.error(
`Blog posts not ready when creating RSS feed â attempt ${rssRetries}`
);
setTimeout(() => {
postFeed(req, res);
}, 1000);
}
return;
}
res.set(Header.Content.Type, MimeType.XML);
res.write(render(blog));
res.end();
}
示例5: createWebService
async function createWebService() {
const app = Express();
const port = process.env['PORT'] || 3000;
log.info(
`Starting ${
config.isProduction ? 'production' : 'development'
} application`
);
defineViews(app);
if (false) {
//config.needsAuth) {
// must authenticate before normal routes are available
route.authentication(app);
app.listen(port);
log.info(`Listening for authentication on port ${port}`);
} else {
if (config.requireSSL) {
app.use(requireSSL);
}
app.use(blockSpamReferers);
// https://github.com/expressjs/compression/blob/master/README.md
app.use(compress());
app.use(Express.static(path.join(root, 'public')));
await blog.load();
if (blog.loaded) {
// blog must be loaded before routes are defined
route.standard(app);
app.listen(port);
log.info(`Listening on port ${port}`);
} else {
log.error('Blog data failed to load. Stopping application.');
}
}
}
示例6:
.catch(err => {
log.error(err, { photoID });
view.notFound(req, res);
});
示例7:
post.gpx(res).catch(err => {
log.error(err);
res.removeHeader(Header.Content.Type);
res.removeHeader(Header.Content.Disposition);
view.notFound(req, res);
});
示例8:
.catch(err => {
view.notFound(req, res);
log.error(err, { photoTag: slug });
});