here/
lib.rs

1#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3//! One of the oldest and still most commonly used debugging techniques looks something like this:
4//!
5//! ```ignore
6//! // Do something
7//! println!("here");
8//! // Do something else
9//! ```
10//!
11//! Or if you're feeling real fancy:
12//!
13//! ```ignore
14//! // Do something
15//! println!("here 1");
16//! // Do something else
17//! println!("here 2");
18//! // Do yet another thing
19//! ```
20//!
21//! It's rather crude, but it's effective... as long as you can find where you put the print
22//! statements.
23//!
24//! Well, [`here`] is here to help! Usage is simple:
25//!
26//! ```ignore
27//! here!(); // prints "filename:lineno" to stdout
28//! ```
29//!
30//! What's that? You want to print to stderr instead of stdout? Then just use [`ehere`]. It's the
31//! same great taste as [`here`], but with stderr!
32//!
33//! Oh? So you've decided to use the wonderful `log` crate? Don't worry, we've got you covered
34//! there, too. With the optional `log` feature enabled, you get five new macros! One for each log
35//! level!
36//!
37//! ```ignore
38//! here_trace!(); // log a trace message of "filename:lineno"
39//! here_debug!(); // log a debug message of "filename:lineno"
40//! here_info!(); // log a info message of "filename:lineno"
41//! here_warn!(); // log a warn message of "filename:lineno"
42//! here_error!(); // log a error message of "filename:lineno"
43//! ```
44//!
45//! Huh? You want add more information? Don't worry we've got you covered. Each `here` macro can
46//! accept a format string and arguments just like the `format!` macro!
47//!
48//! ```ignore
49//! here!("A message."); // prints "(filename:lineno): A message."
50//! here!("Something: 0x{:02x}", 16);  // prints "(filename:lineno): Something: 0x0f"
51//! ```
52//!
53//! ## Feature Flags
54//! - `log`: Adds several macros to work with the `log` crate.
55//! - `off_on_release`: Makes it so that nothing is printed on release builds (enabled by default).
56//! - `std`: Adds std support (enabled by default). Because `println!` and `eprintln!` are both part
57//!    of the std library, this will get rid of the [`here`] and [`ehere`] macros. Useful if you're
58//!    just using the `log` crate.
59
60#[cfg(feature = "log")]
61mod log_rules;
62
63#[cfg(feature = "std")]
64#[cfg(not(all(not(debug_assertions), feature = "off_on_release")))]
65mod with_std;
66
67#[cfg(feature = "std")]
68#[cfg(all(not(debug_assertions), feature = "off_on_release"))]
69mod dummies;