本文整理汇总了TypeScript中@sample-stack/utils.logger.error方法的典型用法代码示例。如果您正苦于以下问题:TypeScript logger.error方法的具体用法?TypeScript logger.error怎么用?TypeScript logger.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@sample-stack/utils.logger
的用法示例。
在下文中一共展示了logger.error方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
module.hot.status(event => {
if (event === 'abort' || event === 'fail') {
logger.error('HMR error status: ' + event);
// Signal webpack.run.js to do full-reload of the back-end
process.exit(250);
}
});
示例2: catch
module.hot.dispose(data => {
try {
(data as any).subscriptionServer = subscriptionServer;
} catch (error) {
logger.error(error.stack);
}
});
示例3: addGraphQLSubscriptions
module.hot.accept(['./api/subscriptions'], () => {
try {
addGraphQLSubscriptions(server);
} catch (error) {
logger.error(error.stack);
}
});
示例4: stripCircular
(e, req, res, next) => {
if (req.path === pathname) {
const stack = e.stack.toString().replace(/[\n]/g, '\\n');
res.status(200).send(`[{"data": {}, "errors":[{"message": "${stack}"}]}]`);
} else {
logger.error(e);
if (__DEV__ || !assetMap) {
assetMap = JSON.parse(fs.readFileSync(path.join(__FRONTEND_BUILD_DIR__, 'assets.json')).toString());
}
const serverErrorScript = `<script charset="UTF-8">window.__SERVER_ERROR__=${JSON.stringify(
stripCircular(e),
)};</script>`;
const vendorScript = assetMap['vendor.js']
? `<script src="/${assetMap['vendor.js']}" charSet="utf-8"></script>`
: '';
res.status(200).send(
`<html>${serverErrorScript}<body><div id="content"></div>
${vendorScript}
<script src="/${assetMap['index.js']}" charSet="utf-8"></script>
</body></html>`,
);
}
};
示例5: it
it('getCount', async (done) => {
try {
const count = await repo.getCount();
done();
} catch (err) {
logger.error(err);
done.fail();
}
});
示例6: catch
module.hot.dispose(() => {
try {
if (server) {
server.close();
}
} catch (error) {
logger.error(error.stack);
}
});
示例7: callback
origin: (origin, callback) => {
if (corsWhitelist.indexOf(origin) !== -1) {
callback(null, true);
} else {
// TODO: only throw when in debug mode
logger.error('url (%s) is not in the whitelist', origin);
// callback(new Error('Not allowed by CORS'))
logger.warn('allowing all origins temporarily, you need to disable it.');
callback(null, true);
}
},