浏览代码

Merge pull request #58 from xeptore/patch-1

Improve documentation
Sam Clements 3 年之前
父节点
当前提交
c374d15912
共有 2 个文件被更改,包括 12 次插入12 次删除
  1. 6 6
      README.md
  2. 6 6
      src/lib.rs

+ 6 - 6
README.md

@@ -28,13 +28,13 @@ fn main() {
 
 
 This outputs:
 This outputs:
 
 
-```
+```txt
 2022-01-19T17:27:07.013874956Z WARN [logging_example] This is an example message.
 2022-01-19T17:27:07.013874956Z WARN [logging_example] This is an example message.
 ```
 ```
 
 
 You can run the above example with:
 You can run the above example with:
 
 
-```bash
+```sh
 cargo run --example init
 cargo run --example init
 ```
 ```
 
 
@@ -42,14 +42,14 @@ Coloured output and timestamps will be enabled by default. You can remove these
 features and their respective dependencies by disabling all features in your
 features and their respective dependencies by disabling all features in your
 `Cargo.toml`.
 `Cargo.toml`.
 
 
-```
+```toml
 [dependencies.simple_logger]
 [dependencies.simple_logger]
 default-features = false
 default-features = false
 ```
 ```
 
 
 To include the `timestamps` feature, but not the `colors` feature:
 To include the `timestamps` feature, but not the `colors` feature:
 
 
-```
+```toml
 [dependencies.simple_logger]
 [dependencies.simple_logger]
 default-features = false
 default-features = false
 features = ["timestamps"]
 features = ["timestamps"]
@@ -57,7 +57,7 @@ features = ["timestamps"]
 
 
 To include the `colors` feature, but not the `timestamps` feature:
 To include the `colors` feature, but not the `timestamps` feature:
 
 
-```
+```toml
 [dependencies.simple_logger]
 [dependencies.simple_logger]
 default-features = false
 default-features = false
 features = ["colors"]
 features = ["colors"]
@@ -65,7 +65,7 @@ features = ["colors"]
 
 
 To direct logging output to `stderr` use the `stderr` feature:
 To direct logging output to `stderr` use the `stderr` feature:
 
 
-```
+```toml
 [dependencies.simple_logger]
 [dependencies.simple_logger]
 features = ["stderr"]
 features = ["stderr"]
 ```
 ```

+ 6 - 6
src/lib.rs

@@ -2,7 +2,7 @@
 //!
 //!
 //! Optional features include timestamps, colored output and logging to stderr.
 //! Optional features include timestamps, colored output and logging to stderr.
 //!
 //!
-//! ```
+//! ```rust
 //! simple_logger::SimpleLogger::new().env().init().unwrap();
 //! simple_logger::SimpleLogger::new().env().init().unwrap();
 //!
 //!
 //! log::warn!("This is an example message.");
 //! log::warn!("This is an example message.");
@@ -12,19 +12,19 @@
 //!
 //!
 //! Just initialize logging without any configuration:
 //! Just initialize logging without any configuration:
 //!
 //!
-//! ```
+//! ```rust
 //! simple_logger::init().unwrap();
 //! simple_logger::init().unwrap();
 //! ```
 //! ```
 //!
 //!
 //! Set the log level from the `RUST_LOG` environment variable:
 //! Set the log level from the `RUST_LOG` environment variable:
 //!
 //!
-//! ```
+//! ```rust
 //! simple_logger::init_with_env().unwrap();
 //! simple_logger::init_with_env().unwrap();
 //! ```
 //! ```
 //!
 //!
 //! Hardcode a default log level:
 //! Hardcode a default log level:
 //!
 //!
-//! ```
+//! ```rust
 //! simple_logger::init_with_level(log::Level::Warn).unwrap();
 //! simple_logger::init_with_level(log::Level::Warn).unwrap();
 //! ```
 //! ```
 
 
@@ -488,7 +488,7 @@ fn set_up_color_terminal() {
     }
     }
 }
 }
 
 
-/// Initialise the logger with it's default configuration.
+/// Initialise the logger with its default configuration.
 ///
 ///
 /// Log messages will not be filtered.
 /// Log messages will not be filtered.
 /// The `RUST_LOG` environment variable is not used.
 /// The `RUST_LOG` environment variable is not used.
@@ -496,7 +496,7 @@ pub fn init() -> Result<(), SetLoggerError> {
     SimpleLogger::new().init()
     SimpleLogger::new().init()
 }
 }
 
 
-/// Initialise the logger with it's default configuration.
+/// Initialise the logger with its default configuration.
 ///
 ///
 /// Log messages will not be filtered.
 /// Log messages will not be filtered.
 /// The `RUST_LOG` environment variable is not used.
 /// The `RUST_LOG` environment variable is not used.