mirror of
https://gitee.com/openharmony/third_party_rust_log
synced 2025-02-17 05:57:38 +00:00
Update to rust master
This commit is contained in:
parent
f20e919838
commit
605cf5a1cd
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
|
||||
name = "log"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
authors = ["The Rust Project Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
@ -13,5 +13,5 @@ Logging macros and infrastructure for Rust
|
||||
"""
|
||||
|
||||
[dependencies.regex]
|
||||
git = "https://github.com/rust-lang/regex"
|
||||
#git = "https://github.com/rust-lang/regex"
|
||||
version = "0.1.0"
|
||||
|
@ -216,7 +216,7 @@ pub const ERROR: u32 = 1;
|
||||
|
||||
thread_local!(static LOCAL_LOGGER: RefCell<Option<Box<Logger + Send>>> = {
|
||||
RefCell::new(None)
|
||||
})
|
||||
});
|
||||
|
||||
/// A trait used to represent an interface to a task-local logger. Each task
|
||||
/// can have its own custom logger which can respond to logging messages
|
||||
|
@ -51,7 +51,7 @@
|
||||
/// 6:main: this is a custom logging level: 6
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! log(
|
||||
macro_rules! log {
|
||||
($lvl:expr, $($arg:tt)+) => ({
|
||||
static LOC: ::log::LogLocation = ::log::LogLocation {
|
||||
line: line!(),
|
||||
@ -63,7 +63,7 @@ macro_rules! log(
|
||||
format_args!(|args| { ::log::log(lvl, &LOC, args) }, $($arg)+)
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/// A convenience macro for logging at the error log level.
|
||||
///
|
||||
@ -87,9 +87,9 @@ macro_rules! log(
|
||||
/// ```
|
||||
///
|
||||
#[macro_export]
|
||||
macro_rules! error(
|
||||
macro_rules! error {
|
||||
($($arg:tt)*) => (log!(::log::ERROR, $($arg)*))
|
||||
)
|
||||
}
|
||||
|
||||
/// A convenience macro for logging at the warning log level.
|
||||
///
|
||||
@ -112,9 +112,9 @@ macro_rules! error(
|
||||
/// WARN:main: you may like to know that a process exited with: 3
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! warn(
|
||||
macro_rules! warn {
|
||||
($($arg:tt)*) => (log!(::log::WARN, $($arg)*))
|
||||
)
|
||||
}
|
||||
|
||||
/// A convenience macro for logging at the info log level.
|
||||
///
|
||||
@ -137,9 +137,9 @@ macro_rules! warn(
|
||||
/// INFO:main: this function is about to return: 3
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! info(
|
||||
macro_rules! info {
|
||||
($($arg:tt)*) => (log!(::log::INFO, $($arg)*))
|
||||
)
|
||||
}
|
||||
|
||||
/// A convenience macro for logging at the debug log level. This macro can also
|
||||
/// be omitted at compile time by passing `--cfg ndebug` to the compiler. If
|
||||
@ -163,9 +163,9 @@ macro_rules! info(
|
||||
/// DEBUG:main: x = 10, y = 20
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! debug(
|
||||
macro_rules! debug {
|
||||
($($arg:tt)*) => (if cfg!(not(ndebug)) { log!(::log::DEBUG, $($arg)*) })
|
||||
)
|
||||
}
|
||||
|
||||
/// A macro to test whether a log level is enabled for the current module.
|
||||
///
|
||||
@ -197,11 +197,11 @@ macro_rules! debug(
|
||||
/// DEBUG:main: x.x = 1, x.y = 2
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! log_enabled(
|
||||
macro_rules! log_enabled {
|
||||
($lvl:expr) => ({
|
||||
let lvl = $lvl;
|
||||
(lvl != ::log::DEBUG || cfg!(not(ndebug))) &&
|
||||
lvl <= ::log::log_level() &&
|
||||
::log::mod_enabled(lvl, module_path!())
|
||||
})
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user