nv-error-simple-trace
v1.0.2
Published
nv-error-simple-trace =============== - simple js-layer trace of call-stack
Downloads
19
Readme
nv-error-simple-trace
- simple js-layer trace of call-stack
- just add a method(dict()) of the built-in-class CallSite
install
- npm install nv-error-simple-trace
usage
const {
detail_stack,
brief_stack,
detail_ance,
brief_ance,
detail_parent,
brief_parent,
} = require("nv-error-simple-trace")
example
function l0() {return(detail_parent())}
function l1() {return(l0())}
function l2() {return(l1())}
var parent_of_l0 = l2()
/*
> parent_of_l0
<ref *2> Info {
FileName: 'REPL11',
ScriptNameOrSourceURL: 'REPL11',
isToplevel: true,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 1,
EnclosingLineNumber: 1,
ColumnNumber: 23,
EnclosingColumnNumber: 1,
EvalOrigin: undefined,
Position: 22,
TypeName: null,
FunctionName: 'l1',
MethodName: 'l1',
PromiseIndex: null,
This: <ref *1> Object [global] {
global: [Circular *1],
clearInterval: [Function: clearInterval],
clearTimeout: [Function: clearTimeout],
setInterval: [Function: setInterval],
setTimeout: [Function: setTimeout] {
[Symbol(nodejs.util.promisify.custom)]: [Getter]
},
queueMicrotask: [Function: queueMicrotask],
performance: Performance {
nodeTiming: PerformanceNodeTiming {
name: 'node',
entryType: 'node',
startTime: 0,
duration: 11079.414198994637,
nodeStart: 0.13837003707885742,
v8Start: 1.0361030101776123,
bootstrapComplete: 25.680065989494324,
environment: 11.201781988143921,
loopStart: 50.35906100273132,
loopExit: -1,
idleTime: 10951.477346
},
timeOrigin: 1652589943849.616
},
clearImmediate: [Function: clearImmediate],
setImmediate: [Function: setImmediate] {
[Symbol(nodejs.util.promisify.custom)]: [Getter]
},
l0: [Function: l0],
l1: [Function: l1],
l2: [Function: l2],
parent_of_l0: [Circular *2]
},
Function: [Function: l1]
}
>
*/
function l0() {return(brief_stack())}
function l1() {return(l0())}
function l2() {return(l1())}
var stacks = l2()
/*
> stacks
[
Info {
FileName: 'REPL16',
ScriptNameOrSourceURL: 'REPL16',
isToplevel: true,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 1,
EnclosingLineNumber: 1,
ColumnNumber: 23,
EnclosingColumnNumber: 1,
EvalOrigin: undefined,
Position: 22,
TypeName: null,
FunctionName: 'l0',
MethodName: 'l0',
PromiseIndex: null,
},
Info {
FileName: 'REPL17',
ScriptNameOrSourceURL: 'REPL17',
isToplevel: true,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 1,
EnclosingLineNumber: 1,
ColumnNumber: 23,
EnclosingColumnNumber: 1,
EvalOrigin: undefined,
Position: 22,
TypeName: null,
FunctionName: 'l1',
MethodName: 'l1',
PromiseIndex: null,
},
Info {
FileName: 'REPL18',
ScriptNameOrSourceURL: 'REPL18',
isToplevel: true,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 1,
EnclosingLineNumber: 1,
ColumnNumber: 23,
EnclosingColumnNumber: 1,
EvalOrigin: undefined,
Position: 22,
TypeName: null,
FunctionName: 'l2',
MethodName: 'l2',
PromiseIndex: null,
},
Info {
FileName: 'REPL20',
ScriptNameOrSourceURL: 'REPL20',
isToplevel: true,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 1,
EnclosingLineNumber: 1,
ColumnNumber: 14,
EnclosingColumnNumber: 1,
EvalOrigin: undefined,
Position: 13,
TypeName: null,
FunctionName: null,
MethodName: null,
PromiseIndex: null,
},
Info {
FileName: 'node:vm',
ScriptNameOrSourceURL: 'node:vm',
isToplevel: false,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 129,
EnclosingLineNumber: 124,
ColumnNumber: 12,
EnclosingColumnNumber: 3,
EvalOrigin: undefined,
Position: 4095,
TypeName: 'Script',
FunctionName: 'runInThisContext',
MethodName: 'runInThisContext',
PromiseIndex: null,
},
Info {
FileName: 'node:repl',
ScriptNameOrSourceURL: 'node:repl',
isToplevel: false,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 562,
EnclosingLineNumber: 404,
ColumnNumber: 29,
EnclosingColumnNumber: 3,
EvalOrigin: undefined,
Position: 18499,
TypeName: 'REPLServer',
FunctionName: 'defaultEval',
MethodName: null,
PromiseIndex: null,
},
Info {
FileName: 'node:domain',
ScriptNameOrSourceURL: 'node:domain',
isToplevel: true,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 421,
EnclosingLineNumber: 419,
ColumnNumber: 15,
EnclosingColumnNumber: 1,
EvalOrigin: undefined,
Position: 12937,
TypeName: null,
FunctionName: 'bound',
MethodName: null,
PromiseIndex: null,
},
Info {
FileName: 'node:domain',
ScriptNameOrSourceURL: 'node:domain',
isToplevel: false,
isEval: false,
isNative: false,
isAsync: false,
isConstructor: false,
isPromiseAll: false,
LineNumber: 432,
EnclosingLineNumber: 431,
ColumnNumber: 12,
EnclosingColumnNumber: 3,
EvalOrigin: undefined,
Position: 13100,
TypeName: 'REPLServer',
FunctionName: 'runBound',
MethodName: 'eval',
PromiseIndex: null,
}
]
>
*/
APIS
function detail_stack() {
function brief_stack() {
function detail_ance(n=1) {
function brief_ance(n=1) {
function detail_parent() {
function brief_parent() {
LICENSE
- ISC