本文整理汇总了TypeScript中brolog.Brolog类的典型用法代码示例。如果您正苦于以下问题:TypeScript Brolog类的具体用法?TypeScript Brolog怎么用?TypeScript Brolog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Brolog类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: doLog
doLog(logger: Brolog | typeof Brolog, loggerName: string) {
logger.error('LogApp', 'error messsage from %s', loggerName)
logger.warn('LogApp', 'warn message from %s', loggerName)
logger.info('LogApp', 'info message from %s', loggerName)
logger.verbose('LogApp', 'verbose message from %s', loggerName)
logger.silly('LogApp', 'silly message from %s', loggerName)
}
示例2: constructor
constructor(
private authService: AuthService
, private router: Router
, private log: Brolog
) {
log.verbose('AuthGuardService', 'constructor()')
}
示例3: beforeEach
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
{
provide: Brolog,
useFactory() { return Brolog.instance('info') },
},
Injector,
],
})
})
示例4: doLog
function doLog() {
log.error('LogApp', 'error')
log.warn('LogApp', 'warn')
log.info('LogApp', 'info')
log.verbose('LogApp', 'verbose')
log.silly('LogApp', 'silly')
}
示例5: updateTimer
public updateTimer(delayTime?: number) {
delayTime = delayTime || this.delayTime()
log.verbose('Talker', 'updateTimer(%s)', delayTime)
if (this.timer) { clearTimeout(this.timer) }
this.timer = setTimeout(this.say.bind(this), delayTime, 3)
}
示例6: load
public load() {
const text = this.obj.text.join(', ')
log.verbose('Talker', 'load(%s)', text)
this.obj.text = []
this.obj.time = []
return text
}
示例7: canActivate
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
this.log.verbose('AuthGuardService', 'canActivate(%s)', state.url)
if (this.authService.loggedIn) {
this.log.verbose('AuthGuardService', 'canActivate() YES')
return true
}
this.log.verbose('AuthGuardService', 'canActivate() NO')
// Store the attempted URL for redirecting
this.authService.redirectUrl = state.url
// Navigate to the login page
this.router.navigate(['/login'])
return false
}
示例8: talk
.on('message', async m => {
if (m.self()) { return }
// co(function* () {
// const msg = yield m.load()
const room = m.room()
if (room && /Wechaty/i.test(await room.topic())) {
log.info('Bot', 'talk: %s' , m)
talk(m)
} else {
log.info('Bot', 'recv: %s' , m)
}
// })
// .catch(e => log.error('Bot', 'on message rejected: %s' , e))
})
示例9: say
public async say() {
log.verbose('Talker', 'say()')
const text = this.load()
await this.thinker(text)
.then(reply => this.emit('say', reply))
this.timer = undefined
}
示例10: constructor
constructor(
thinker: (text: string) => Promise<string>,
) {
log.verbose('Talker()')
super()
this.thinker = thinker
this.obj = {
text: [],
time: [],
}
}