Selaa lähdekoodia

Deprecate old functions & update README

Aloïs Micard 4 vuotta sitten
vanhempi
commit
5a952ab1bf
2 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 1 1
      README.md
  2. 12 0
      src/lib.rs

+ 1 - 1
README.md

@@ -13,7 +13,7 @@ Usage
 
 ```rust
 fn main() {
-    simple_logger::init().unwrap();
+    SimpleLogger::new().init().unwrap();
 
     log::warn!("This is an example message.");
 }

+ 12 - 0
src/lib.rs

@@ -201,6 +201,10 @@ fn set_up_color_terminal() {
 }
 
 /// See [this](struct.SimpleLogger.html#method.with_level)
+#[deprecated(
+since = "1.8.0",
+note = "Please use the Builder pattern instead."
+)]
 pub fn init_with_level(level: Level) -> Result<(), SetLoggerError> {
     SimpleLogger::new()
         .with_level(level.to_level_filter())
@@ -208,11 +212,19 @@ pub fn init_with_level(level: Level) -> Result<(), SetLoggerError> {
 }
 
 /// See [this](struct.SimpleLogger.html#method.new)
+#[deprecated(
+since = "1.8.0",
+note = "Please use the Builder pattern instead."
+)]
 pub fn init() -> Result<(), SetLoggerError> {
     SimpleLogger::new().init()
 }
 
 /// See [this](struct.SimpleLogger.html#method.from_env)
+#[deprecated(
+since = "1.8.0",
+note = "Please use the Builder pattern instead."
+)]
 pub fn init_by_env() {
     SimpleLogger::from_env().init().unwrap()
 }