Inject the logger for Asterinas

This commit is contained in:
Chen Chengjun
2024-11-15 16:58:06 +08:00
committed by Tate, Hongliang Tian
parent 7865469998
commit 0cb2ea562e
18 changed files with 149 additions and 5 deletions

View File

@ -0,0 +1,30 @@
// SPDX-License-Identifier: MPL-2.0
//! The logger implementation for Asterinas.
//!
//! This logger now has the most basic logging functionality, controls the output
//! based on the globally set log level. Different log levels will be represented
//! with different colors if enabling `log_color` feature.
//!
//! This logger guarantees _atomicity_ under concurrency: messages are always
//! printed in their entirety without being mixed with messages generated
//! concurrently on other cores.
//!
//! IRQs are disabled while printing. So do not print long log messages.
#![no_std]
#![deny(unsafe_code)]
extern crate alloc;
use component::{init_component, ComponentInitError};
mod aster_logger;
mod console;
pub use console::_print;
#[init_component]
fn init() -> Result<(), ComponentInitError> {
aster_logger::init();
Ok(())
}