diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-29 19:40:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-30 15:04:43 -0800 |
| commit | 262c1efe6352a3e4dba4d8aebc4d9bd96849cd71 (patch) | |
| tree | 4096f26993c2db2e0c95181170ef63f46cf3cb7e /src/liblog | |
| parent | 023dfb0c898d851dee6ace2f8339b73b5287136b (diff) | |
| download | rust-262c1efe6352a3e4dba4d8aebc4d9bd96849cd71.tar.gz rust-262c1efe6352a3e4dba4d8aebc4d9bd96849cd71.zip | |
Register new snapshots
Diffstat (limited to 'src/liblog')
| -rw-r--r-- | src/liblog/lib.rs | 38 | ||||
| -rw-r--r-- | src/liblog/macros.rs | 57 |
2 files changed, 0 insertions, 95 deletions
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 1d865868f18..b30938ae7f5 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -268,8 +268,6 @@ impl Drop for DefaultLogger { } } -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] /// This function is called directly by the compiler when using the logging /// macros. This function does not take into account whether the log level /// specified is active or not, it will always log something if this method is @@ -304,42 +302,6 @@ pub fn log(level: u32, loc: &'static LogLocation, args: fmt::Arguments) { set_logger(logger); } -// NOTE(stage0): Remove function after a snapshot -#[cfg(stage0)] -/// This function is called directly by the compiler when using the logging -/// macros. This function does not take into account whether the log level -/// specified is active or not, it will always log something if this method is -/// called. -/// -/// It is not recommended to call this function directly, rather it should be -/// invoked through the logging family of macros. -#[doc(hidden)] -pub fn log(level: u32, loc: &'static LogLocation, args: &fmt::Arguments) { - // Test the literal string from args against the current filter, if there - // is one. - match unsafe { FILTER.as_ref() } { - Some(filter) if !filter.is_match(args.to_string().as_slice()) => return, - _ => {} - } - - // Completely remove the local logger from TLS in case anyone attempts to - // frob the slot while we're doing the logging. This will destroy any logger - // set during logging. - let mut logger = LOCAL_LOGGER.with(|s| { - s.borrow_mut().take() - }).unwrap_or_else(|| { - box DefaultLogger { handle: io::stderr() } as Box<Logger + Send> - }); - logger.log(&LogRecord { - level: LogLevel(level), - args: *args, - file: loc.file, - module_path: loc.module_path, - line: loc.line, - }); - set_logger(logger); -} - /// Getter for the global log level. This is a function so that it can be called /// safely #[doc(hidden)] diff --git a/src/liblog/macros.rs b/src/liblog/macros.rs index 2e8302cc10f..233d1c049f4 100644 --- a/src/liblog/macros.rs +++ b/src/liblog/macros.rs @@ -12,8 +12,6 @@ #![macro_escape] -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] /// The standard logging macro /// /// This macro will generically log over a provided level (of type u32) with a @@ -67,61 +65,6 @@ macro_rules! log { }) } -// NOTE(stage0): Remove macro after a snapshot -#[cfg(stage0)] -/// The standard logging macro -/// -/// This macro will generically log over a provided level (of type u32) with a -/// format!-based argument list. See documentation in `std::fmt` for details on -/// how to use the syntax. -/// -/// # Example -/// -/// ``` -/// #![feature(phase)] -/// #[phase(plugin, link)] extern crate log; -/// -/// fn main() { -/// log!(log::WARN, "this is a warning {}", "message"); -/// log!(log::DEBUG, "this is a debug message"); -/// log!(6, "this is a custom logging level: {level}", level=6u); -/// } -/// ``` -/// -/// Assumes the binary is `main`: -/// -/// ```{.bash} -/// $ RUST_LOG=warn ./main -/// WARN:main: this is a warning message -/// ``` -/// -/// ```{.bash} -/// $ RUST_LOG=debug ./main -/// DEBUG:main: this is a debug message -/// WARN:main: this is a warning message -/// ``` -/// -/// ```{.bash} -/// $ RUST_LOG=6 ./main -/// DEBUG:main: this is a debug message -/// WARN:main: this is a warning message -/// 6:main: this is a custom logging level: 6 -/// ``` -#[macro_export] -macro_rules! log { - ($lvl:expr, $($arg:tt)+) => ({ - static LOC: ::log::LogLocation = ::log::LogLocation { - line: line!(), - file: file!(), - module_path: module_path!(), - }; - let lvl = $lvl; - if log_enabled!(lvl) { - format_args!(|args| { ::log::log(lvl, &LOC, args) }, $($arg)+) - } - }) -} - /// A convenience macro for logging at the error log level. /// /// # Example |
