Skip to content

Commit d92b6a2

Browse files
authored
fix: make debug mode actually work (#1305)
1 parent d3d6f98 commit d92b6a2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/raven.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,11 @@ Raven.prototype = {
21352135
},
21362136

21372137
_logDebug: function(level) {
2138-
if (this._originalConsoleMethods[level] && this.debug) {
2138+
// We allow `Raven.debug` and `Raven.config(DSN, { debug: true })` to not make backward incompatible API change
2139+
if (
2140+
this._originalConsoleMethods[level] &&
2141+
(this.debug || this._globalOptions.debug)
2142+
) {
21392143
// In IE<10 console methods do not have their own 'apply' method
21402144
Function.prototype.apply.call(
21412145
this._originalConsoleMethods[level],

test/raven.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ describe('globals', function() {
262262
assert.isTrue(originalConsoleMethods[level].calledOnce);
263263
});
264264

265+
it('should write to console when Raven.config(DSN, { debug: true })', function() {
266+
Raven._globalOptions.debug = true;
267+
this.sinon.stub(originalConsoleMethods, level);
268+
Raven._logDebug(level, message);
269+
assert.isTrue(originalConsoleMethods[level].calledOnce);
270+
});
271+
265272
it('should handle variadic arguments', function() {
266273
Raven.debug = true;
267274
this.sinon.stub(originalConsoleMethods, level);

0 commit comments

Comments
 (0)