本文整理匯總了TypeScript中@toba/logger.log.info方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript log.info方法的具體用法?TypeScript log.info怎麽用?TypeScript log.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@toba/logger.log
的用法示例。
在下文中一共展示了log.info方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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.');
}
}
}
示例2: sendFromCache
function sendFromCache(res: Response, slug: string): boolean {
if (config.cache.views) {
const item = cache.get(slug);
if (item !== null) {
// send cached item directly
writeItemToResponse(res, item);
return true;
} else {
log.info(`"${slug}" not cached`, { slug });
}
} else {
log.warn(`Caching disabled for ${slug}`, { slug });
}
return false;
}