Implement Node.js trace events support with CLI flag and logging

This commit is contained in:
Cursor Agent
2025-06-05 23:10:56 +00:00
parent 5de8c08c50
commit dfc2edbddd
9 changed files with 528 additions and 15 deletions

View File

@@ -237,6 +237,7 @@ pub const Arguments = struct {
clap.parseParam("--zero-fill-buffers Boolean to force Buffer.allocUnsafe(size) to be zero-filled.") catch unreachable,
clap.parseParam("--redis-preconnect Preconnect to $REDIS_URL at startup") catch unreachable,
clap.parseParam("--no-addons Throw an error if process.dlopen is called, and disable export condition \"node-addons\"") catch unreachable,
clap.parseParam("--trace-event-categories <STR> Enable trace event recording for specified categories (comma separated)") catch unreachable,
};
const auto_or_run_params = [_]ParamType{
@@ -851,6 +852,10 @@ pub const Arguments = struct {
if (args.flag("--zero-fill-buffers")) {
Bun__Node__ZeroFillBuffers = true;
}
if (args.option("--trace-event-categories")) |categories| {
ctx.runtime_options.trace_event_categories = categories;
}
}
if (opts.port != null and opts.origin == null) {
@@ -1547,6 +1552,7 @@ pub const Command = struct {
/// compatibility.
expose_gc: bool = false,
preserve_symlinks_main: bool = false,
trace_event_categories: []const u8 = "",
};
var global_cli_ctx: Context = undefined;