diff --git a/crates/ewwii/src/plugin.rs b/crates/ewwii/src/plugin.rs index 33576c8..425e45a 100644 --- a/crates/ewwii/src/plugin.rs +++ b/crates/ewwii/src/plugin.rs @@ -8,8 +8,21 @@ pub(crate) struct EwwiiImpl { impl EwwiiAPI for EwwiiImpl { // General + // "PCL = Plugin Controlled Log" + fn print(&self, msg: &str) { + println!("[PCL] {}", msg); + } + fn log(&self, msg: &str) { - println!("[HOST LOG] {}", msg); + log::info!("[PCL] {}", msg); + } + + fn warn(&self, msg: &str) { + log::warn!("[PCL] {}", msg); + } + + fn error(&self, msg: &str) { + log::error!("[PCL] {}", msg); } // Rhai Manipulation Stuff diff --git a/crates/ewwii_plugin_api/Cargo.toml b/crates/ewwii_plugin_api/Cargo.toml index 748c388..d65fe1a 100644 --- a/crates/ewwii_plugin_api/Cargo.toml +++ b/crates/ewwii_plugin_api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ewwii_plugin_api" -version = "0.1.1" +version = "0.2.0" authors = ["byson94 "] edition = "2021" license = "GPL-3.0-or-later" diff --git a/crates/ewwii_plugin_api/src/export.rs b/crates/ewwii_plugin_api/src/export.rs index d9b3d11..fc05552 100644 --- a/crates/ewwii_plugin_api/src/export.rs +++ b/crates/ewwii_plugin_api/src/export.rs @@ -2,7 +2,7 @@ //! It allows fast and easy export of plugins by abstracting //! the FFI (Foreign Function Interface) related code needed. -/// Automatically implements `create_plugin` for a given fieldless structure +/// Automatically implements `create_plugin` for a given fieldless structure #[macro_export] macro_rules! export_plugin { ($plugin_struct:ty) => { diff --git a/crates/ewwii_plugin_api/src/lib.rs b/crates/ewwii_plugin_api/src/lib.rs index cc1f4d9..ec51d56 100644 --- a/crates/ewwii_plugin_api/src/lib.rs +++ b/crates/ewwii_plugin_api/src/lib.rs @@ -33,7 +33,13 @@ use rhai::Engine; pub trait EwwiiAPI: Send + Sync { // == General Stuff == // /// Print a message from the host + fn print(&self, msg: &str); + /// Log a message from the host fn log(&self, msg: &str); + /// Log a warning from the host + fn warn(&self, msg: &str); + /// Log an error from the host + fn error(&self, msg: &str); // == Rhai Manipulation Stuff == // /// Perform an action on the current real-time rhai engine