/// Request to print a log message on the host.
///
/// Note that this will be only displayed if the host is enabled to display log messages with
/// given level and target.
///
/// Instead of using directly, prefer setting up `RuntimeLogger` and using `log` macros.
Request to print a log message on the host.
Note that this will be only displayed if the host is enabled to display log messages with
given level and target.

Instead of using directly, prefer setting up `RuntimeLogger` and using `log` macros.
Request to print a log message on the host . Note that this will be only displayed if the host is enabled to display log messages with given level and target . Instead of using directly prefer setting up ` RuntimeLogger ` and using ` log ` macros .
pub fn log(level: LogLevel, target: &str, message: &[u8]) {
		if let Ok(message) = std::str::from_utf8(message) {
			// TODO remove this attention boost
			println!("\x1b[0;36m[{}]\x1b[0m {}", target, message);
			let level = match level {
				LogLevel::Error => log::Level::Error,
				LogLevel::Warn => log::Level::Warn,
				LogLevel::Info => log::Level::Info,
				LogLevel::Debug => log::Level::Debug,
				LogLevel::Trace => log::Level::Trace,
			};
			// FIXME: this logs with target sp_io::logging instead of the provided target!
			log::log!(target: target, level, "{}", message,);
		}
	}
pub fn log ( level : LogLevel , target : & str , message : & [ u8 ] ) { if let Ok ( message ) = std :: str :: from_utf8 ( message ) { // TODO remove this attention boost println ! ( " \x1b \x1b " target message ) ; let level = match level { LogLevel :: Error => log :: Level :: Error , LogLevel :: Warn => log :: Level :: Warn , LogLevel :: Info => log :: Level :: Info , LogLevel :: Debug => log :: Level :: Debug , LogLevel :: Trace => log :: Level :: Trace , } ; // FIXME: this logs with target sp_io::logging instead of the provided target! log :: log ! ( target target level " " message ) ; } }
Request to print a log message on the host.
Request to print a log message on the host .
level
LogLevel
target
&str
message
&[u8]