#[cfg(debug_assertions)]
use web_sys::console;
#[cfg_attr(not(debug_assertions), allow(unused_variables))]
fn styled_log(level: &str, emoji: &str, color: &str, msg: &str) {
#[cfg(debug_assertions)]
{
let prefix = format!("%c[SDK] {} {}", emoji, level.to_uppercase());
let style = format!("color: {}; font-weight: bold", color);
console::log_3(&prefix.into(), &style.into(), &msg.into());
}
}
pub fn success(msg: &str) {
styled_log("success", "✅", "lightgreen", msg);
}
pub fn error(msg: &str) {
styled_log("error", "❌", "red", msg);
}
pub fn warn(msg: &str) {
styled_log("warn", "⚠️", "orange", msg);
}
pub fn info(msg: &str) {
styled_log("info", "ℹ️", "#3399ff", msg);
}
pub fn debug(msg: &str) {
styled_log("debug", "🔧", "#888", msg);
}
pub fn trace(msg: &str) {
styled_log("trace", "📍", "#aaa", msg);
}