File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,19 @@ Rust's log levels map to the browser's console log in the following way.
27
27
| ` warn!() ` | ` console.warn() ` |
28
28
| ` error!() ` | ` console.error() ` |
29
29
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
+
30
43
## Code Size
31
44
32
45
[ Twiggy] ( https://github.com/rustwasm/twiggy ) reports this library adding about
Original file line number Diff line number Diff line change 35
35
//! formatting of log messages (timestamps, file and line info, etc.) this crate can be used with
36
36
//! the [`fern`] logger via the [`console_log::log`] function.
37
37
//!
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
+ //! 
50
+ //!
38
51
//! # Code Size
39
52
//!
40
53
//! [Twiggy] reports this library adding about 180Kb to the size of a minimal wasm binary in a
You can’t perform that action at this time.
0 commit comments