Skip to content

Disable maxMessageLength truncation by default #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ Optional settings

.. describe:: maxMessageLength

By default, raven truncates messages to a max length of 100
characters. You can customize the max length with this parameter.
By default, Raven does not truncate messages. If you need to truncate
characters for whatever reason, you may set this to limit the length.

.. describe:: transport

Expand Down
2 changes: 1 addition & 1 deletion src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Raven() {
includePaths: [],
crossOrigin: 'anonymous',
collectWindowErrors: true,
maxMessageLength: 100
maxMessageLength: 0
};
this._ignoreOnError = 0;
this._isRavenInstalled = false;
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function objectMerge(obj1, obj2) {
}

function truncate(str, max) {
return str.length <= max ? str : str.substr(0, max) + '\u2026';
return !max || str.length <= max ? str : str.substr(0, max) + '\u2026';
}

/**
Expand Down
1 change: 1 addition & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('utils', function () {
assert.equal(truncate('lolol', 3), 'lol\u2026');
assert.equal(truncate('lolol', 10), 'lolol');
assert.equal(truncate('lol', 3), 'lol');
assert.equal(truncate(new Array(1000).join('f'), 0), new Array(1000).join('f'));
});
});

Expand Down