本文整理汇总了TypeScript中signale.Signale.config方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Signale.config方法的具体用法?TypeScript Signale.config怎么用?TypeScript Signale.config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类signale.Signale
的用法示例。
在下文中一共展示了Signale.config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: return
export const initializeServer = () => {
const logger = new signale.Signale({ scope: 'Auto reloading' })
logger.config({ displayTimestamp: true })
// Since this port is hard-coded, it must match background.tsx
const socketIOServer = io.listen(8890)
logger.await('Ready for a browser extension to connect')
socketIOServer.on('connect', () => {
logger.info('Browser extension connected')
})
socketIOServer.on('disconnect', () => {
logger.info('Browser extension disconnected')
})
return () => {
if (Object.keys(socketIOServer.clients().connected).length === 0) {
logger.warn('No browser extension has connected yet, so no reload was triggered')
logger.warn("- Make sure it's enabled")
logger.warn("- Make sure it's in developer mode (unpacked extension)")
logger.warn('- Try manually reloading it 🔄')
} else {
logger.info('Triggering a reload of browser extensions')
socketIOServer.emit('file.change', {})
}
}
}
示例2: setTimeout
signale.time("test");
signale.time();
signale.time();
setTimeout(() => {
signale.timeEnd();
signale.timeEnd();
signale.timeEnd("test");
}, 500);
// --- Test 6: Configuration --- //
// Overrides any existing `package.json` config
signale.config({
displayFilename: true,
displayTimestamp: true,
displayDate: false
});
signale.success("Hello from the Global scope");
function scopedConfigTest() {
// `fooLogger` inherits the config of `signale`
const fooLogger = signale.scope("foo scope");
// Overrides both `signale` and `package.json` configs
fooLogger.config({
displayFilename: true,
displayTimestamp: false,
displayDate: true
});