Ox.trace: formatting; add documentation
This commit is contained in:
parent
6a5cb61880
commit
eae9074cea
1 changed files with 8 additions and 2 deletions
|
@ -272,16 +272,22 @@ Ox.print = function() {
|
|||
return args.join(' ');
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.trace <f> Prints its arguments to the console, followed by a stack trace
|
||||
(arg, ...) -> <s> String
|
||||
@*/
|
||||
Ox.trace = function() {
|
||||
var args = Ox.slice(arguments);
|
||||
try {
|
||||
throw new Error();
|
||||
} catch (e) {
|
||||
if (e.stack) {
|
||||
args.push('\n' + e.stack.split('\n').slice(2).join('\n'));
|
||||
args.push(
|
||||
'\n' + Ox.clean(e.stack.split('\n').slice(2).join('\n'))
|
||||
);
|
||||
}
|
||||
}
|
||||
Ox.print.apply(null, args);
|
||||
return Ox.print.apply(null, args);
|
||||
};
|
||||
|
||||
/*@
|
||||
|
|
Loading…
Reference in a new issue