本文整理匯總了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);
}
},