本文整理匯總了TypeScript中hsnode.log類的典型用法代碼示例。如果您正苦於以下問題:TypeScript log類的具體用法?TypeScript log怎麽用?TypeScript log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了log類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
m.request = (req: any) => {
if (req.url === 'config.json') {
log.info(`loading ${req.url}`);
const fname = `${__dirname}/example/${req.url}`;
return fs.readJsonFile(fname)
.then((data:any) => (typeof data === 'string')? JSON.parse(data) : data)
.then((data:any) => { log.info(`loaded ${req.url}:\n${data}`); m.redraw(); return data; })
.catch(log.error);
} else {
log.error(`did not find ${req.url}`);
}
};
示例2: test
test('Config from file should match snapshot', (done) => {
log.info(`config test`);
expect(root).toMatchSnapshot();
done();
});
示例3: setTimeout
setTimeout(() => { log.info(`done`); done(); }, 100);
示例4: beforeAll
beforeAll((done) => {
log.info(`config before`); // required to make timing for test work
m.mount(root, {view: () => m(Config, {source:'config.json', context:[layout]})});
setTimeout(() => { log.info(`done`); done(); }, 100);
});