Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

console-pro-trace

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-pro-trace

tarce your function. calc the case time.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

console trace

tarce your function. calc the case time.

when you have cluster process. you can use mter to split the log view.

usage

// test/demo1.ts
import { console, registerClassDebug, IS_IN_TRACE_MODE } from '../src/';
class A {
    async say(word) {
        console.log(word)
    }
}
registerClassDebug(A, 'A');

const a = new A();
a.say('qaq');

The log is not output by default. You need to configure environment variables:TRACE or CONSOLE_PRO_TRACE.

for example:

# in unix
TRACE='*' node your-app.js


# in windows cmd
set TRACE="*"
node your-app.js


# in windows powershell

$env:TRACE="*"
node your-app.js

now, run the demo1.ts: TRACE=* ts-node test/demo1.ts

image

PS:the console instance is from console-pro.

about the TRACE

example 1

registerClassDebug(A, 'A');
registerClassDebug(B, 'B');
TRACE="A,B"

example 2

registerClassDebug(A, 'my/A');
registerClassDebug(B, 'my/B');
TRACE="my/*"

extends config

you can define static function getUnDebugMethodNames for class to skip debug some function.

class A {
    async say(word) {
        console.log(word)
    }
    private _dosomething(cb){
        setTimeout(cb, 1000)
    }
    static getUnDebugMethodNames(){
        return ["_dosomething"]
    }
}

debug an object

import { console, registerInstanceDebug } from '../src/';
registerInstanceDebug({
    async say(word) {
        console.log(word)
    }
    _dosomething(cb){
        setTimeout(cb, 1000)
    }
    getUnDebugMethodNames(){
        return ["_dosomething"]
    }
}, 'my/simple/instance');

FAQs

Package last updated on 18 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc