Skip to content

Commit

Permalink
Updated README.md and documentation about "color" feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Apr 20, 2020
1 parent 65aca96 commit db4b195
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ Rust's log levels map to the browser's console log in the following way.
| `warn!()` | `console.warn()` |
| `error!()` | `console.error()` |

## Colors

The `"color"` feature will add styling to the log messages.

`Cargo.toml`
```toml
console_log = { version = "0.1", features = ["color"] }
```

The styled log messages will be rendered as follows:

![Styled log messages](img/log_messages_styled.png)

## Code Size

[Twiggy](https://github.com/rustwasm/twiggy) reports this library adding about
Expand Down
Binary file added img/log_messages_styled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@
//! formatting of log messages (timestamps, file and line info, etc.) this crate can be used with
//! the [`fern`] logger via the [`console_log::log`] function.
//!
//! ## Colors
//!
//! The `"color"` feature will add styling to the log messages.
//!
//! `Cargo.toml`
//! ```toml
//! console_log = { version = "0.1", features = ["color"] }
//! ```
//!
//! The styled log messages will be rendered as follows:
//!
//! ![Styled log messages](img/log_messages_styled.png)
//!
//! # Code Size
//!
//! [Twiggy] reports this library adding about 180Kb to the size of a minimal wasm binary in a
Expand Down

0 comments on commit db4b195

Please sign in to comment.