generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 385
Open
Description
From what I've observed, some packages on @opentelemetry are built on the premise of util.inspect.
- @opentelemetry/resources
- @opentelemetry/sdk-metrics
- @opentelemetry/sdk-trace-base
- @opentelemetry/resource-detector-aws
- @opentelemetry/resource-detector-container
To avoid any misunderstanding, I believe that the components necessary for implementation already exist in llrt_logging, and simply implementing the following in the util module will work.
However, it completely ignores the options, so the output is not what you expect.
fn inspect<'js>(ctx: Ctx<'js>, args: Rest<Value<'js>>) -> Result<String> {
let mut result = String::new();
let mut options = llrt_logging::FormatOptions::new(&ctx, false, true)?;
llrt_logging::build_formatted_string(&mut result, &ctx, args, &mut options)?;
result.push(NEWLINE);
Ok(result)
}
impl ModuleDef for UtilModule {
// ...
fn evaluate<'js>(ctx: &Ctx<'js>, exports: &Exports<'js>) -> Result<()> {
export_default(ctx, exports, |default| {
let globals = ctx.globals();
// ...
let inspect_fn = Function::new(ctx.clone(), inspect)?.with_name("inspect")?;
inspect_fn.prop("custom", primordials.symbol_custom_inspect.clone())?;
default.set("inspect", inspect_fn)?;
Ok(())
})
}
}I find it difficult to support the util.inspect options without breaking the existing llrt_logging implementation, so I hope that someone knowledgeable will take on the challenge of implementing it. :)
Metadata
Metadata
Assignees
Labels
No labels