Skip to content

Commit d96031e

Browse files
committed
remove unnecessary log method
1 parent 6f7361b commit d96031e

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

src/util/debug.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ import config from '../config'
66

77
const hasConsole = typeof console !== 'undefined'
88

9-
/**
10-
* Log a message.
11-
*
12-
* @param {String} msg
13-
*/
14-
15-
export function log (msg) {
16-
if (hasConsole && config.debug) {
17-
console.log('[Vue info]: ' + msg)
18-
}
19-
}
20-
219
/**
2210
* We've got a problem here.
2311
*
@@ -29,7 +17,11 @@ export function warn (msg, e) {
2917
console.warn('[Vue warn]: ' + msg)
3018
/* istanbul ignore if */
3119
if (config.debug) {
32-
console.warn((e || new Error('Warning Stack Trace')).stack)
20+
if (e) {
21+
throw e
22+
} else {
23+
console.warn((new Error('Warning Stack Trace')).stack)
24+
}
3325
}
3426
}
3527
}

test/unit/specs/directives/public/el_spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ describe('el', function () {
77
beforeEach(function () {
88
el = document.createElement('div')
99
spyWarns()
10-
spyOn(_, 'log')
1110
})
1211

1312
it('normal', function (done) {

test/unit/specs/util/debug_spec.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var _ = require('../../../../src/util')
22
var config = require('../../../../src/config')
3-
var infoPrefix = '[Vue info]: '
43
var warnPrefix = '[Vue warn]: '
54

65
if (typeof console !== 'undefined') {
@@ -15,18 +14,6 @@ if (typeof console !== 'undefined') {
1514
}
1615
})
1716

18-
it('log when debug is true', function () {
19-
config.debug = true
20-
_.log('hello')
21-
expect(console.log).toHaveBeenCalledWith(infoPrefix + 'hello')
22-
})
23-
24-
it('not log when debug is false', function () {
25-
config.debug = false
26-
_.log('bye')
27-
expect(console.log).not.toHaveBeenCalled()
28-
})
29-
3017
it('warn when silent is false', function () {
3118
config.silent = false
3219
_.warn('oops')

0 commit comments

Comments
 (0)