]> git.lizzy.rs Git - rust.git/blobdiff - src/liblog/lib.rs
std: Rename Show/String to Debug/Display
[rust.git] / src / liblog / lib.rs
index 08b01e956e1ac83c073524226f8ca2ef5200d41d..ba0f04d67da3cff1bf129fc08b0b0cfda7516250 100644 (file)
 //! if logging is disabled, none of the components of the log will be executed.
 
 #![crate_name = "log"]
-#![experimental = "use the crates.io `log` library instead"]
+#![unstable = "use the crates.io `log` library instead"]
+#![staged_api]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/",
        html_playground_url = "http://play.rust-lang.org/")]
+
+#![allow(unknown_features)]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
+#![allow(unknown_features)] #![feature(int_uint)]
+#![allow(unstable)]
 #![deny(missing_docs)]
 
 extern crate regex;
@@ -233,21 +239,15 @@ struct DefaultLogger {
 }
 
 /// Wraps the log level with fmt implementations.
-#[derive(Copy, PartialEq, PartialOrd)]
+#[derive(Copy, PartialEq, PartialOrd, Show)]
 pub struct LogLevel(pub u32);
 
-impl fmt::Show for LogLevel {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        fmt::String::fmt(self, fmt)
-    }
-}
-
-impl fmt::String for LogLevel {
+impl fmt::Display for LogLevel {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let LogLevel(level) = *self;
         match LOG_LEVEL_NAMES.get(level as uint - 1) {
-            Some(ref name) => fmt::String::fmt(name, fmt),
-            None => fmt::String::fmt(&level, fmt)
+            Some(ref name) => fmt::Display::fmt(name, fmt),
+            None => fmt::Display::fmt(&level, fmt)
         }
     }
 }
@@ -287,7 +287,7 @@ 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().index(&FullRange)) => return,
+        Some(filter) if !filter.is_match(&args.to_string()[]) => return,
         _ => {}
     }
 
@@ -382,7 +382,7 @@ fn enabled(level: u32,
     // Search for the longest match, the vector is assumed to be pre-sorted.
     for directive in iter.rev() {
         match directive.name {
-            Some(ref name) if !module.starts_with(name.index(&FullRange)) => {},
+            Some(ref name) if !module.starts_with(&name[]) => {},
             Some(..) | None => {
                 return level <= directive.level
             }
@@ -397,7 +397,7 @@ fn enabled(level: u32,
 /// `Once` primitive (and this function is called from that primitive).
 fn init() {
     let (mut directives, filter) = match os::getenv("RUST_LOG") {
-        Some(spec) => directive::parse_logging_spec(spec.index(&FullRange)),
+        Some(spec) => directive::parse_logging_spec(&spec[]),
         None => (Vec::new(), None),
     };