log4wasm 0.1.3

A stylish rust-generated WebAssembly logging utility.
Documentation
<div align="center">
<h1>log4wasm</h1>

<a href="https://crates.io/crates/log4wasm">
    <img src="https://img.shields.io/crates/v/log4wasm" />
</a>
<br/>
<p>:sparkles: A rust-generated wasm logging utility with styling capabilities for display in a web console.</p>
</div>


> Be advised that this crate is still considered experimental however should be stable for use in its current state.

<img src="demo.png" alt="output of generated example log"/>

# Getting started


You can start using `log4wasm` by adding the following in your Cargo.toml `[dependencies]` section:

```toml
log4wasm = "0.1.3"
```

**Note**: `log4wasm` relies on the [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) crate for code-generation therefore it is the current recommended approach for building reliably.

# Example


A minimal use-case within your application would look something like the following:

```rust
fn main() {
    log4wasm::log::info!("A basic, unformatted log with a level of INFO.");
}
```

`log4wasm` provides a suite of macros out of the box available for use. These may be favorable in instances where building a custom logger is not necessary.

```rust
    log4wasm::log::trace!("a basic trace log!");
    log4wasm::log::debug!("a basic debug log!");
    log4wasm::log::info!("a basic info log!");
    log4wasm::log::warning!("a basic warn log!");
    log4wasm::log::error!("a basic error log!");
    log4wasm::log::fatal!("a basic fatal log!");
```

Alternatively, custom loggers may be created using the designated builder:

```rust
use log4wasm::logger::{Level, Logger};
use log4wasm::styled::{Color, Decoration, Styled};

// Create a custom logger with a desired name and log level.
let logger = Logger::new_builder()
            .named("MAIN")
            .with_level(Level::Debug)
            .build();

// Create a styling to be applied on the output written to console.
let styled_log = Styled::with_content(format!("A formatted debug log named \"MAIN\" with green, underlined text and an argument of {}", 1))
            .colored(Color::Green)
            .decorate(Decoration::Underline)
            .into_log();

// Write the styled output to console.
logger.print_fmt(styled_log);
```