
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
debug-trace
Advanced tools
Adds a handy `trace` flag to the console object to prepend the file and line number
This fork of console-trace adds the following features:
console.format
e.g.: // overridable console string prefix formatting function
console.format = function (c) {
return c.getDate() + ": [" + c.filename + ":" + c.getLineNumber() + "] " + c.functionName;
};
log
, error
ect.Extends the native Node.JS console
object to prefix logging functions
with the CallSite information.
To read more about runtime stack trace introspection you can refer to this article.
$ npm install debug-trace
require('debug-trace')([options])
Boolean
: defaults to false) always print the callsite info even without accessing methods from the t
or traced
getters.String
: defaults to process.cwd()
) the path that will be stripped from the callsite infoBoolean|Object
: defaults to undefined
) terminal colors support flag or a custom color objectBoolean
: defaults to false) callsite alignment flag, when true prints infos on the rightFunction
: defaults to console.log
) overwrites debug
module log function, can be turned off with overwriteDebugLog: false
Boolean
: defaults to true) monkey patches process.stdout.write
and process.stderr.write
with console.log
and console.error
in case it is called from debug (function with the name log
)require('debug-trace')
You can add the t
or traced
getter to your calls to obtain a stacktrace:
console.t.log('a');
console.traced.log('a');
You can also make every console call trace:
require('debug-trace')({
always: true,
})
...
console.log('a'); // tracing
console.error('a'); // tracing
You can align the callsite infos to the right
require('debug-trace')({
always: true,
right: true
})
...
console.log('a'); // tracing right
console.error('a'); // tracing right
You can change defaults colors too
require('./debug-trace')({
always: true,
colors: {
warn: '35',
info: '32'
}
})
...
console.warn('a'); // magenta
console.info('a'); // green
To customize the string that's prefixed to the calls, override the
console.traceFormat
function.
If you have more sophisticated logging needs, or don't wish to extend
console
, I suggest you look at tracer.
I only added some functionality to the original console-trace:
MIT License
FAQs
Adds a handy `trace` flag to the console object to prepend the file and line number
The npm package debug-trace receives a total of 340 weekly downloads. As such, debug-trace popularity was classified as not popular.
We found that debug-trace demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.