Skip to content

Commit

Permalink
Remove log! and error! macros
Browse files Browse the repository at this point in the history
  • Loading branch information
flosse committed Mar 5, 2023
1 parent a00354d commit 2bc11f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 51 deletions.
49 changes: 0 additions & 49 deletions src/shortcuts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// @TODO merge with `pub use` & `prelude` in `lib.rs` and `browser::util`?

use crate::virtual_dom::{At, Attrs};
use std::fmt;

/// Allows to write nested macros.
///
Expand Down Expand Up @@ -488,54 +487,6 @@ macro_rules! nodes {
};
}

pub const fn wrap_debug<T>(object: T) -> T
where
T: fmt::Debug,
{
object
}

/// A convenience function for logging to the web browser's console. We use
/// a macro to supplement the log function to allow multiple inputs.
#[macro_export]
#[deprecated(note = "Use something like https://crates.io/crates/gloo-console instead")]
macro_rules! log {
{ $($expr:expr),* $(,)? } => {
{
let mut formatted_exprs = Vec::new();
$(
formatted_exprs.push(format!("{:#?}", $crate::shortcuts::wrap_debug(&$expr)));
)*
$crate::shortcuts::log_1(
&formatted_exprs
.as_slice()
.join(" ")
.into()
);
}
};
}

/// Similar to log!
#[macro_export]
#[deprecated(note = "Use something like https://crates.io/crates/gloo-console instead")]
macro_rules! error {
{ $($expr:expr),* $(,)? } => {
{
let mut formatted_exprs = Vec::new();
$(
formatted_exprs.push(format!("{:#?}", $crate::shortcuts::wrap_debug(&$expr)));
)*
web_sys::console::error_1(
&formatted_exprs
.as_slice()
.join(" ")
.into()
);
}
};
}

/// A key-value pairs, where the keys and values must implement `ToString`.
#[macro_export]
macro_rules! key_value_pairs {
Expand Down
4 changes: 2 additions & 2 deletions src/virtual_dom/node/el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ impl<Ms> El<Ms> {
_ => false,
};
if script_found {
error!("Script tag found inside mount point! \
Please check https://docs.rs/seed/latest/seed/app/builder/struct.Builder.html#examples");
web_sys::console::error_1(&wasm_bindgen::JsValue::from("Script tag found inside mount point! \
Please check https://docs.rs/seed/latest/seed/app/builder/struct.Builder.html#examples"));
}

for child in &self.children {
Expand Down

0 comments on commit 2bc11f8

Please sign in to comment.