diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index db53bd3..20c1983 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: MiniServ-nix-runner steps: - name: Checkout repository diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 3c6bd68..066a47c 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -10,7 +10,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: MiniServ-nix-runner steps: - name: Checkout repository diff --git a/README.md b/README.md index 29fb1a6..cd0b97d 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,80 @@ [![cargo build](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/build.yml/badge.svg)](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/build.yml) [![cargo test](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/test.yml/badge.svg)](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/test.yml) -A console logging library for Rust applications. +Tiny console logger for Rust built on the `log` facade. ## Installation -This crate is published to the `gitea` Cargo registry. +This crate is published to the `gitea` Cargo registry hosted on git.moturpin.com. + +1) Tell Cargo about the registry (once per machine/workspace), e.g. in `.cargo/config.toml`: + +``` +[registries.gitea] +index = "sparse+https://git.moturpin.com/api/packages/Matsubaa/cargo/" +``` + +2) Add the dependency to your `Cargo.toml`: + +``` +[dependencies] +kt_log = { version = "0.1", registry = "gitea" } +``` + +If the registry is private, authenticate with: + +``` +cargo login --registry gitea +``` + +## Usage + +Initialize the logger once at program start, then use the standard `log` macros. Messages at `Error`, `Warn`, and `Info` are printed; `Debug` and `Trace` are ignored by default. + +```rust +use kt_log::init; +use log::{error, warn, info, debug, trace}; + +fn main() { + init().expect("failed to init logger"); + + error!("something failed"); + warn!("watch out"); + info!("hello {}", "world"); + debug!("this will not be shown"); + trace!("this will not be shown either"); +} +``` + +Example output: + +``` +[ERROR] something failed +[WARN] watch out +[INFO] hello world +``` + +## Features + +- Minimal, zero-config console logger +- Built on `log` 0.4 — works with the standard logging macros +- Simple output format: `[LEVEL] message` +- Default max level: `Info` (prints `Error`, `Warn`, `Info`) + +## Notes & Limitations + +- The maximum log level is currently fixed to `Info` at initialization time. +- `Debug` and `Trace` messages are intentionally not printed. + +## Development + +- Build: `cargo build` +- Test: `cargo test` + +## License + +Licensed under the MIT License. See [LICENSE](LICENSE). + +## Contributing + +Contributions are welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md).