diff --git a/editor/Cargo.toml b/editor/Cargo.toml index ef07f74ce5..c0db504392 100644 --- a/editor/Cargo.toml +++ b/editor/Cargo.toml @@ -27,3 +27,4 @@ sim = { path = "../sim" } structopt = "0.2" strum = "0.9.0" strum_macros = "0.9.0" +yansi = "0.4.0" diff --git a/editor/src/macros.rs b/editor/src/macros.rs index 433f4807f7..bb3ae72482 100644 --- a/editor/src/macros.rs +++ b/editor/src/macros.rs @@ -1,5 +1,6 @@ // Call the log crate, but pre-set the target. +#[allow(unused_macros)] macro_rules! debug { ( $( $x:expr ),* ) => { { diff --git a/editor/src/main.rs b/editor/src/main.rs index 0634d71a74..82c1c49b50 100644 --- a/editor/src/main.rs +++ b/editor/src/main.rs @@ -29,6 +29,7 @@ extern crate structopt; extern crate strum; #[macro_use] extern crate strum_macros; +extern crate yansi; #[macro_use] mod macros; diff --git a/editor/src/plugins/logs.rs b/editor/src/plugins/logs.rs index 88cd886e17..2d2c49f37e 100644 --- a/editor/src/plugins/logs.rs +++ b/editor/src/plugins/logs.rs @@ -56,10 +56,17 @@ impl Log for LogAdapter { } fn log(&self, record: &Record) { + use yansi::Paint; + let line = format!( "[{}] [{}] {}", - record.level(), - record.target(), + Paint::white(record.level()), + match record.target() { + "UI" => Paint::red("UI"), + "sim" => Paint::green("sim"), + "map" => Paint::blue("map"), + x => Paint::cyan(x), + }, record.args() ); println!("{}", line);