mirror of https://gitee.com/bigwinds/arangodb
added trace
This commit is contained in:
parent
e68080a638
commit
0ba6329a12
|
@ -289,23 +289,15 @@
|
|||
/// log message.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.log = function () {
|
||||
'use strict';
|
||||
|
||||
var msg;
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, arguments);
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
log("info", msg);
|
||||
};
|
||||
exports.log = exports.info;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief time
|
||||
///
|
||||
/// @FUN{console.time(@FA{name})}
|
||||
///
|
||||
/// Creates a new timer under the given name. Call @FN{timeEnd} with the same
|
||||
/// name to stop the timer and log the time elapsed.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.time = function (label) {
|
||||
|
@ -316,6 +308,10 @@
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief timeEnd
|
||||
///
|
||||
/// @FUN{console.timeEnd(@FA{name})}
|
||||
///
|
||||
/// Stops a timer created by a call to @FN{time} and logs the time elapsed.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.timeEnd = function(label) {
|
||||
|
@ -333,6 +329,23 @@
|
|||
exports.log('%s: %dms', label, duration);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief trace
|
||||
///
|
||||
/// @FUN{console.trace()}
|
||||
///
|
||||
/// Logs a static stack trace of JavaScript execution at the point where it is
|
||||
/// called.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.trace = function () {
|
||||
var err = new Error();
|
||||
err.name = 'trace';
|
||||
err.message = sprintf.apply(sprintf, arguments);
|
||||
Error.captureStackTrace(err, arguments.callee);
|
||||
exports.log(err.stack);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief warn
|
||||
///
|
||||
|
|
|
@ -696,7 +696,7 @@ static v8::Handle<v8::Value> JS_SizeFile (v8::Arguments const& argv) {
|
|||
///
|
||||
/// @FUN{console.getline()}
|
||||
///
|
||||
/// Reads in a line from the console.
|
||||
/// Reads in a line from the console and returns it as string.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static v8::Handle<v8::Value> JS_Getline (v8::Arguments const& argv) {
|
||||
|
|
Loading…
Reference in New Issue