Skip to content

Better logging #88

@l3r8yJ

Description

@l3r8yJ

I found something interesting in std, here's an example:

use std::panic::Location;
fn validate(/*something that you want to validate*/) -> ... {
    if something_not_valid {
        let location = Location::caller();
        return Err(anyhow!(format!(
            "{location}: ..."
        )));
    }
}

this code produces a message like:
src/filename.rs:line:position: ...

it might be helpful to

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions