#print #err #log #static #cargo-toml #errst

unmaintained stderr

A library that using macro to write to io::stderr() like print!()/println!()

12 releases (6 breaking)

Uses old Rust 2015

0.8.0 Aug 9, 2017
0.7.1 Apr 24, 2017
0.7.0 Feb 11, 2017
0.2.1 Dec 26, 2016

#28 in #err

Download history 121/week @ 2024-08-24 126/week @ 2024-08-31 160/week @ 2024-09-07 143/week @ 2024-09-14 134/week @ 2024-09-21 296/week @ 2024-09-28 170/week @ 2024-10-05 341/week @ 2024-10-12 356/week @ 2024-10-19 299/week @ 2024-10-26 213/week @ 2024-11-02 292/week @ 2024-11-09 173/week @ 2024-11-16 234/week @ 2024-11-23 207/week @ 2024-11-30 232/week @ 2024-12-07

860 downloads per month
Used in 5 crates (4 directly)

MIT license

30KB
571 lines

Build status Latest version All downloads Downloads of latest version Documentation

stderr

A library that using macro to write to io::stderr() like print!()/println!() for rust.

Usage

On Cargo.toml:

 [dependencies]
 stderr = "0.8.0"

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

#[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:

  [dependencies]
  stderr = "0.3.0"

Or

  • Only import you need by macro_use

On Code:

  #[macro_use(err,errln,errst,errstln)]
  extern crate stderr;

About StaticMut or log::*, please read document

ChangLog

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.

Dependencies

~0.7–1MB
~16K SLoC