Browse Source

Release 1.12.0

Sam Clements 3 years ago
parent
commit
3657ac51db
3 changed files with 34 additions and 6 deletions
  1. 1 1
      Cargo.toml
  2. 1 1
      LICENSE
  3. 32 4
      src/lib.rs

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "simple_logger"
-version = "1.11.0"
+version = "1.12.0"
 license = "MIT"
 authors = ["Sam Clements <[email protected]>"]
 description = "A logger that prints all messages with a readable output format"

+ 1 - 1
LICENSE

@@ -1,4 +1,4 @@
-Copyright 2015-2019 Sam Clements
+Copyright 2015-2021 Sam Clements
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 

+ 32 - 4
src/lib.rs

@@ -1,4 +1,32 @@
 //! A logger that prints all messages with a simple, readable output format.
+//!
+//! Optional features include timestamps and colored output.
+//!
+//! ```
+//! simple_logger::SimpleLogger::new().env().init().unwrap();
+//!
+//! log::warn!("This is an example message.");
+//! ```
+//!
+//! Some shortcuts are available for common use cases.
+//!
+//! Just initialize logging without any configuration:
+//!
+//! ```
+//! simple_logger::init().unwrap();
+//! ```
+//!
+//! Set the log level from the `RUST_LOG` environment variable:
+//!
+//! ```
+//! simple_logger::init_with_env().unwrap();
+//! ```
+//!
+//! Hardcode a default log level:
+//!
+//! ```
+//! simple_logger::init_with_level(log::Level::Warn).unwrap();
+//! ```
 
 #[cfg(feature = "chrono")]
 use chrono::Local;
@@ -41,7 +69,7 @@ impl SimpleLogger {
     ///
     /// ```no_run
     /// use simple_logger::SimpleLogger;
-    /// SimpleLogger::new().init().unwrap();
+    /// SimpleLogger::new().env().init().unwrap();
     /// log::warn!("This is an example message.");
     /// ```
     ///
@@ -77,7 +105,7 @@ impl SimpleLogger {
     #[must_use = "You must call init() to begin logging"]
     #[deprecated(
         since = "1.12.0",
-        note = "Use [`env`](#method.env) instead. This predates use of the builder pattern in this library."
+        note = "Use [`env`](#method.env) instead. Will be removed in version 2.0.0."
     )]
     pub fn from_env() -> SimpleLogger {
         SimpleLogger::new()
@@ -163,7 +191,7 @@ impl SimpleLogger {
     #[must_use = "You must call init() to begin logging"]
     #[deprecated(
         since = "1.11.0",
-        note = "This is a leftover from before there was the builder pattern. Use [`with_module_level`](#method.with_module_level) instead."
+        note = "Use [`with_module_level`](#method.with_module_level) instead. Will be removed in version 2.0.0."
     )]
     pub fn with_target_levels(
         mut self,
@@ -345,7 +373,7 @@ pub fn init_with_level(level: Level) -> Result<(), SetLoggerError> {
 /// This does the same as [`init_with_env`] but unwraps the result.
 #[deprecated(
     since = "1.12.0",
-    note = "Use [`init_with_env`] instead, which does not unwrap the result."
+    note = "Use [`init_with_env`] instead, which does not unwrap the result. Will be removed in version 2.0.0."
 )]
 pub fn init_by_env() {
     init_with_env().unwrap()