https://github.com/biluohc/stderr
A library that using macro to write to io::stderr() like print!/println! for Rust.
https://github.com/biluohc/stderr
debug macro rust static stderr
Last synced: about 1 month ago
JSON representation
A library that using macro to write to io::stderr() like print!/println! for Rust.
- Host: GitHub
- URL: https://github.com/biluohc/stderr
- Owner: biluohc
- License: mit
- Created: 2016-12-25T12:23:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-13T09:26:34.000Z (about 8 years ago)
- Last Synced: 2025-02-08T03:15:45.356Z (8 months ago)
- Topics: debug, macro, rust, static, stderr
- Language: Rust
- Homepage: https://crates.io/crates/stderr
- Size: 39.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/biluohc/stderr)
[](https://crates.io/crates/stderr)
[](https://crates.io/crates/stderr)
[](https://crates.io/crates/stderr)
[](https://docs.rs/stderr)# [stderr](https://github.com/biluohc/stderr)
A library that using macro to write to `io::stderr()` like `print!()/println!()` for rust.# Usage
On Cargo.toml:
```toml
[dependencies]
stderr = "0.8.1"
```# About stderr
Usage as same as `print!/println!`.1. `err!`/`errln!`: Panics if writing to `io::stderr()` fails.
2. `errst!`/`errstln!`: Do nothing if writing to `io::stderr()` fails(silent->st).# Example
```Rust
#[macro_use]
extern crate stderr;fn main() {
println!("err!/errln!/errst!/errstln!()@stderr !");
let vec = vec![1, 2, 3, 4, 5];
let s = std::env::args().nth(0).unwrap();err!("err!(expr\\n)\n");
err!("err!(String: vec![1, 2, 3, 4, 5])\n{}: {:?}", s, vec);
errln!();
errln!("errln!(expr)");println!();
errst!("errst!(expr\\n)\n");
errst!("errst!(String: vec![1, 2, 3, 4, 5])\n{}: {:?}", s, vec);
errstln!();
errstln!("errstln!(expr)");
}
```
# If you only need `errxxx` and don't want be polluted by other macros, you can:
* use v0.3.0(The part has been stable since this version)On Cargo.toml:
```toml
[dependencies]
stderr = "0.3.0"
```## Or
* Only import you need by `macro_use`
On Code:
```rust
#[macro_use(err,errln,errst,errstln)]
extern crate stderr;
```# About `StaticMut` or `log::*`, please read [document](https://docs.rs/stderr)
## ChangLog
2017-0813 **0.8.1** remove `-log`2017-0530 **0.8.0** `log::*, StaticMut`
2017-0424 **0.7.1** `loc!()` and `Loger::init(module_path!())`
2017-0211 **0.7.0** Supports multiple packages.
2017-0126 **0.6.1** Don't repeat initialization,fix #2.
2017-0126 **0.6.0** Refactoring and update API to `stderr::Loger; init!(),db!(),dbln!(),dbst!(),dbstln!()` for `LOG=module_path!()` and `--log/-log module_path!()`,add Documentation.
2017-0116 __0.5.0__ Add `stderr::loger::Loger;init(), debug!(),debugln!(),debugst!(),debugstln!()` for `LOG=debug` and `--log/-log debug`.