mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Merge pull request #317 from ripple/fix-browser-log
Check that Error.stack is available, fixes logging in browser
This commit is contained in:
@@ -69,13 +69,15 @@ Log.prototype.error = Log.makeLevel(4);
|
||||
*/
|
||||
|
||||
function getLogInfo(message, args) {
|
||||
var stack = new Error().stack;
|
||||
|
||||
return [
|
||||
// Timestamp
|
||||
'[' + new Date().toISOString() + ']',
|
||||
message,
|
||||
'--',
|
||||
// Location
|
||||
(new Error()).stack.split('\n')[4].replace(/^\s+/, ''),
|
||||
(typeof stack === 'string') ? stack.split('\n')[4].replace(/^\s+/, '') : '',
|
||||
'\n'
|
||||
].concat(args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user