fix: make deprecation warnings less verbose (#22128)

This commit makes deprecation warnings less verbose by default.

Only a single warnings is issued per deprecated API use.

`DENO_VERBOSE_WARNINGS` env var can be provided to enable more detailed
logging for each use of API including a stack trace.

9c036c84-0044-4cb6-9c8e-deb641f43712
This commit is contained in:
Bartek Iwańczuk 2024-01-26 16:41:16 +01:00 committed by GitHub
parent c66f7b6d8d
commit 9e0495baa7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 103 additions and 43 deletions

View file

@ -61,6 +61,7 @@ pub struct BootstrapOptions {
pub maybe_binary_npm_command_name: Option<String>,
pub node_ipc_fd: Option<i64>,
pub disable_deprecated_api_warning: bool,
pub verbose_deprecated_api_warning: bool,
}
impl Default for BootstrapOptions {
@ -90,6 +91,7 @@ impl Default for BootstrapOptions {
maybe_binary_npm_command_name: None,
node_ipc_fd: None,
disable_deprecated_api_warning: false,
verbose_deprecated_api_warning: false,
}
}
}
@ -121,6 +123,8 @@ struct BootstrapV8<'a>(
Option<&'a str>,
// disable_deprecated_api_warning,
bool,
// verbose_deprecated_api_warning
bool,
);
impl BootstrapOptions {
@ -141,6 +145,7 @@ impl BootstrapOptions {
self.has_node_modules_dir,
self.maybe_binary_npm_command_name.as_deref(),
self.disable_deprecated_api_warning,
self.verbose_deprecated_api_warning,
);
bootstrap.serialize(ser).unwrap()