本文整理汇总了TypeScript中signale.Signale类的典型用法代码示例。如果您正苦于以下问题:TypeScript Signale类的具体用法?TypeScript Signale怎么用?TypeScript Signale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Signale类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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', {})
}
}
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:26,代码来源:auto-reloading.ts
示例2: Signale
import { Signale, SignaleOptions } from "signale";
// --- Test 1: Basic Usage --- //
const signale = new Signale();
signale.success("Operation successful");
signale.debug("Hello", "from", "L59");
signale.pending("Write release notes for 1.2.0");
signale.fatal(new Error("Unable to acquire lock"));
signale.watch("Recursively watching build directory...");
signale.complete({
prefix: "[task]",
message: "Fix issue #59",
suffix: "(@klauscfhq)"
});
// --- Test 2: Custom Loggers --- //
type CustomLogger = "remind" | "santa";
const optionsCustom: SignaleOptions<CustomLogger> = {
stream: process.stdout,
scope: "custom",
types: {
remind: {
badge: "**",
color: "yellow",
label: "reminder"
},
santa: {
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:31,代码来源:signale-tests.ts
示例3: scopedConfigTest
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
});
fooLogger.success("Hello from the Local scope");
}
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:13,代码来源:signale-tests.ts
示例4:
socketIOServer.on('disconnect', () => {
logger.info('Browser extension disconnected')
})
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:3,代码来源:auto-reloading.ts
示例5:
setTimeout(() => {
signale.timeEnd();
signale.timeEnd();
signale.timeEnd("test");
}, 500);
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:5,代码来源:signale-tests.ts
注:本文中的signale.Signale类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论