td

typescript-debug

TypeScript decorator to conditionally trace method calls via https://github.com/visionmedia/debug

Showing:

Popularity

Downloads/wk

14

GitHub Stars

9

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

1

Size (min+gzip)

2.5KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

typescript-debug

TypeScript decorator to conditionally trace method calls via https://github.com/visionmedia/debug

Build Status

usage

Below is a simple usage scenario for the TraceClass decorator. The configuration options are not yet documented but you can find them in lib/index.ts.

Given the input file trace-example.ts:

import {TraceClass} from "typescript-debug";

@TraceClass({ tracePrefix: "example" })
class TraceExample {
    constructor(public abc: string) { }
    public getAbc() {
        return this.abc;
    }
    public combineWithAbc(xyz: string) {
        return this.getAbc() + " and " + xyz;
    }
}

let te = new TraceExample("ABC");
te.combineWithAbc("XYZ");

Trace output would look like this:

blake@ignignokt:~/example$ tsc --module commonjs --target es5 --experimentalDecorators trace-example.ts
blake@ignignokt:~/example$ DEBUG=\* node trace-example.js
  example:TraceExample new(ABC) +0ms
  example:TraceExample combineWithAbc(XYZ) +4ms
  example:TraceExample getAbc() +3ms
  example:TraceExample getAbc: ABC +0ms
  example:TraceExample combineWithAbc: ABC and XYZ +0ms

Note that the output is normally colorized in your console by debug.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100