clippy-tracing

Crates.ioclippy-tracing
lib.rsclippy-tracing
version0.7.0
sourcesrc
created_at2023-06-20 20:04:50.464461
updated_at2023-10-13 13:58:23.162182
descriptionA tool to add, remove and check for `tracing::instrument` in large projects where it is infeasible to manually add it to thousands of functions.
homepage
repositoryhttps://github.com/JonathanWoollett-Light/clippy-tracing
max_upload_size
id895456
size47,472
Jonathan Woollett-Light (JonathanWoollett-Light)

documentation

README

clippy-tracing

Crates.io codecov

This is rough tool

A tool to add, remove and check for tracing::instrument in large projects where it is infeasible to manually add it to thousands of functions.

Installation

cargo install clippy-tracing

Usage

This is tested in the readme() integration test.

fn main() {
    println!("Hello World!");
}
fn add(lhs: i32, rhs: i32) -> i32 {
    lhs + rhs
}
#[cfg(tests)]
mod tests {
    fn sub(lhs: i32, rhs: i32) -> i32 {
        lhs - rhs
    }
    #[test]
    fn test_one() {
        assert_eq!(add(1,1), sub(2, 1));
    }
}
clippy-tracing --action check # Missing instrumentation at {path}:9:4.\n
echo $? # 2
clippy-tracing --action fix
echo $? # 0
#[tracing::instrument(level = "trace", skip())]
fn main() {
    println!("Hello World!");
}
#[tracing::instrument(level = "trace", skip(lhs, rhs))]
fn add(lhs: i32, rhs: i32) -> i32 {
    lhs + rhs
}
#[cfg(tests)]
mod tests {
    #[tracing::instrument(level = "trace", skip(lhs, rhs))]
    fn sub(lhs: i32, rhs: i32) -> i32 {
        lhs - rhs
    }
    #[test]
    fn test_one() {
        assert_eq!(add(1,1), sub(2, 1));
    }
}
clippy-tracing --action check
echo $? # 0
clippy-tracing --action strip
echo $? # 0
fn main() {
    println!("Hello World!");
}
fn add(lhs: i32, rhs: i32) -> i32 {
    lhs + rhs
}
#[cfg(tests)]
mod tests {
    fn sub(lhs: i32, rhs: i32) -> i32 {
        lhs - rhs
    }
    #[test]
    fn test_one() {
        assert_eq!(add(1,1), sub(2, 1));
    }
}

log

Supports log_instrument when compiled with the log feature.

Commit count: 45

cargo fmt