add Ox.trace (name still TBD): print with stack trace

This commit is contained in:
rolux 2014-05-24 16:30:20 +02:00
parent 97233d417d
commit 767a3133b7

View file

@ -273,6 +273,18 @@ Ox.print = function() {
return args.join(' '); return args.join(' ');
}; };
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'));
}
}
Ox.print.apply(null, args);
};
/*@ /*@
Ox.uid <f> Returns a unique id Ox.uid <f> Returns a unique id
() -> <n> Unique id () -> <n> Unique id