@distributed-systems/callsite

3.0.1 • Public • Published

Callsite

Get structured callsite information

If you just need structured stack-frames, please use the Stack-Trace library

ESM:

import Callsite from 'es-modules/distributed-systems/callsite/2.0.0+/index.mjs';

NPM:

import Callsite from '@distributed-systems/callsite';

API

Stack Frame format returned from the library

[{
    name: 'new Cls',
    source: 'stack-trace/test/200.000-stack-parser.mjs',
    line: 52,
    column: 27 
}]

Get Callsite Info

const cs = new Callsite();

// get callsite info
const callsite info = cs.getStack(); 

Get Callsite Info, more frames

const cs = new Callsite();

// get callsite info
const callsite info = cs.getStack({
    limit: 100,
}); 

Get Callsite Info, from a custom error

const cs = new Callsite();
const err = new Error('my custom error');

// get callsite info
const callsite info = cs.getStack({
    limit: 100,
    err,
});

Readme

Keywords

Package Sidebar

Install

npm i @distributed-systems/callsite

Weekly Downloads

3,484

Version

3.0.1

License

MIT

Unpacked Size

8.89 kB

Total Files

9

Last publish

Collaborators

  • ee