axlog 0.3.0-preview.2

Macros for multi-level formatted logging used by ArceOS
Documentation

Macros for multi-level formatted logging used by ArceOS.

The log macros, in descending order of level, are: [error!], [warn!], [info!], [debug!], and [trace!].

If it is used in no_std environment, the users need to implement the [LogIf] to provide external functions such as console output.

To use in the std environment, please enable the std feature:

[dependencies]
axlog = { version = "0.1", features = ["std"] }

Cargo features:

  • std: Use in the std environment. If it is enabled, you can use console output without implementing the [LogIf] trait. This is disabled by default.

Examples

use axlog::{debug, error, info, trace, warn};

// Initialize the logger.
axlog::init();
// Set the maximum log level to `info`.
axlog::set_max_level("info");

// The following logs will be printed.
error!("error");
warn!("warn");
info!("info");

// The following logs will not be printed.
debug!("debug");
trace!("trace");