Skip to content

Commit c9296dc

Browse files
committed
Updated README.md and documentation about "color" feature.
1 parent 65aca96 commit c9296dc

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

Diff for: README.md

+13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ Rust's log levels map to the browser's console log in the following way.
2727
| `warn!()` | `console.warn()` |
2828
| `error!()` | `console.error()` |
2929

30+
## Colors
31+
32+
The `"color"` feature adds styling to the log messages.
33+
34+
`Cargo.toml`
35+
```toml
36+
console_log = { version = "0.1", features = ["color"] }
37+
```
38+
39+
The styled log messages will be rendered as follows:
40+
41+
![Styled log messages](img/log_messages_styled.png)
42+
3043
## Code Size
3144

3245
[Twiggy](https://github.com/rustwasm/twiggy) reports this library adding about

Diff for: img/log_messages_styled.png

19.1 KB
Loading

Diff for: src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@
3535
//! formatting of log messages (timestamps, file and line info, etc.) this crate can be used with
3636
//! the [`fern`] logger via the [`console_log::log`] function.
3737
//!
38+
//! ## Colors
39+
//!
40+
//! The `"color"` feature adds styling to the log messages.
41+
//!
42+
//! `Cargo.toml`
43+
//! ```toml
44+
//! console_log = { version = "0.1", features = ["color"] }
45+
//! ```
46+
//!
47+
//! The styled log messages will be rendered as follows:
48+
//!
49+
//! ![Styled log messages](img/log_messages_styled.png)
50+
//!
3851
//! # Code Size
3952
//!
4053
//! [Twiggy] reports this library adding about 180Kb to the size of a minimal wasm binary in a

0 commit comments

Comments
 (0)