Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add more content to README #25

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,53 @@
[actions-badge]: https://github.com/tisonkun/logforth/workflows/CI/badge.svg
[actions-url]:https://github.com/tisonkun/logforth/actions?query=workflow%3ACI

## Overview

A versatile and extensible logging implementation.

The name comes from an antonym to the [Logback](https://logback.qos.ch/) project.
## Usage

Add the dependency to your `Cargo.toml` with:

```shell
cargo add logforth
```

Then, you can use the logger with:

```rust
use log::LevelFilter;
use logforth::append;
use logforth::layout::TextLayout;
use logforth::Dispatch;
use logforth::Logger;

fn main() {
Logger::new().dispatch(
Dispatch::new()
.filter(LevelFilter::Trace)
.layout(TextLayout::default())
.append(append::Stdout),
)
.apply()
.unwrap();

log::error!("Hello error!");
log::warn!("Hello warn!");
log::info!("Hello info!");
log::debug!("Hello debug!");
log::trace!("Hello trace!");
}
```

Read more demos under the [examples](examples) directory.

## Supported Rust Versions (MSRV 1.71)

Logforth is built against the latest stable release. The minimum supported version is 1.71. The current Logforth version is not guaranteed to build on Rust versions earlier than the minimum supported version.

## License and Origin

This project is licensed under [Apache License, Version 2.0](LICENSE).

The name `Logforth` comes from an antonym to the [`Logback`](https://logback.qos.ch/) project.