Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to print also function name #8

Open
qarmin opened this issue Oct 8, 2023 · 1 comment
Open

Allow to print also function name #8

qarmin opened this issue Oct 8, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@qarmin
Copy link

qarmin commented Oct 8, 2023

Currently with such macro

    #[fun_time(message = "Heavy calculations on: {stop_receiver:?}")]
    pub fn find_bad_extensions_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender<ProgressData>>) {

I got this messages

21:19:14.762 [INFO] czkawka_core::bad_extensions: Heavy calculations on: Some(Receiver { .. })
21:19:14.803 [INFO] czkawka_core::bad_extensions: Heavy calculations on: Some(Receiver { .. }): Done in 40.66ms

but would be great to see also function name without needing to manually put there function name

https://github.com/y2kappa/timed - already have such functionality, but produced string is ugly

function=get_random_quote duration=455.291753ms
function=main duration=456.452412ms
@stevenliebregt
Copy link
Owner

How would you like to see this work?

Since the logging message is solely powered by the built-in format! macro and no manual parsing is done, it could be as easy as exposing a fn_name string in case the message string looks like this for example: message = "Heavy calculations in function: {fn_name} or would someting like an extra option to the macro like show_fn = true be preferred, which would produce a message like [find_bad_extensions_files] Heavy calculations ...

@stevenliebregt stevenliebregt added the enhancement New feature or request label Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants