mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
feat(console): countReset
This commit is contained in:
@@ -318,6 +318,7 @@ const CONSOLE_METHOD = [
|
||||
'table',
|
||||
'assert',
|
||||
'count',
|
||||
'countReset',
|
||||
'debug',
|
||||
'group',
|
||||
'groupCollapsed',
|
||||
|
||||
@@ -225,7 +225,6 @@ export default class Log {
|
||||
msg = formatDir(args)
|
||||
break
|
||||
case 'info':
|
||||
icon = 'info'
|
||||
msg = formatMsg(args)
|
||||
break
|
||||
case 'warn':
|
||||
|
||||
@@ -74,7 +74,12 @@ export default class Logger extends Emitter {
|
||||
|
||||
!isUndef(count[label]) ? count[label]++ : (count[label] = 1)
|
||||
|
||||
return this.html(`${label}: ${count[label]}`)
|
||||
return this.info(`${label}: ${count[label]}`)
|
||||
}
|
||||
countReset(label = 'default') {
|
||||
this._count[label] = 0
|
||||
|
||||
return this
|
||||
}
|
||||
assert(...args) {
|
||||
if (isEmpty(args)) return
|
||||
@@ -117,7 +122,7 @@ export default class Logger extends Emitter {
|
||||
if (!startTime) return
|
||||
delete this._timer[name]
|
||||
|
||||
return this.html(`${name}: ${perfNow() - startTime}ms`)
|
||||
return this.info(`${name}: ${perfNow() - startTime}ms`)
|
||||
}
|
||||
clear() {
|
||||
this.silentClear()
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('console', function() {
|
||||
it('timing', function() {
|
||||
tool.time('eruda')
|
||||
tool.timeEnd('eruda')
|
||||
expect($tool.find('.eruda-html')).toHaveText(/eruda: [.\d]+ms/)
|
||||
expect($tool.find('.eruda-info')).toHaveText(/eruda: [.\d]+ms/)
|
||||
})
|
||||
|
||||
it('error', function() {
|
||||
@@ -61,7 +61,7 @@ describe('console', function() {
|
||||
it('count', function() {
|
||||
tool.count('test').clear()
|
||||
tool.count('test')
|
||||
expect($tool.find('.eruda-html')).toContainText('test: 2')
|
||||
expect($tool.find('.eruda-info')).toContainText('test: 2')
|
||||
})
|
||||
|
||||
describe('substitution', function() {
|
||||
|
||||
Reference in New Issue
Block a user