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

expose api to let user control log output #1060

Merged
merged 3 commits into from
Jul 25, 2023
Merged

Conversation

evmar
Copy link
Contributor

@evmar evmar commented Jun 28, 2023

Add
whisper_set_log_callback()
that lets user set a callback for log messages.

Change all the
fprintf(stderr, ...)
to call via the above.

This is nice when embedding whisper.cpp into a larger program that doesn't want to print stuff to stderr.

@evmar
Copy link
Contributor Author

evmar commented Jun 28, 2023

Note: I also considered making a log macro that included the __func__ bit automatically, lemme know if you think that's a good idea. Also if it's literally named log then it shadows std::log the math function so it would need a different name.

whisper.cpp Outdated Show resolved Hide resolved
whisper.cpp Outdated Show resolved Hide resolved
whisper.cpp Show resolved Hide resolved
@evmar evmar force-pushed the log branch 2 times, most recently from e4dfbd6 to a47d489 Compare July 5, 2023 20:01
Add
  whisper_set_log_callback()
that lets user set a callback for log messages.

Change all the
  fprintf(stderr, ...)
to call via the above.
@evmar
Copy link
Contributor Author

evmar commented Jul 5, 2023

OK, I applied your suggestions and rebased.

Copy link
Owner

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sorry for delay

@ggerganov ggerganov merged commit fabf79f into ggerganov:master Jul 25, 2023
33 of 37 checks passed
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this pull request Oct 24, 2023
* expose api to let user control log output

Add
  whisper_set_log_callback()
that lets user set a callback for log messages.

Change all the
  fprintf(stderr, ...)
to call via the above.

* whisper : add <cstdarg>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this pull request Oct 24, 2023
* expose api to let user control log output

Add
  whisper_set_log_callback()
that lets user set a callback for log messages.

Change all the
  fprintf(stderr, ...)
to call via the above.

* whisper : add <cstdarg>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
landtanin pushed a commit to landtanin/whisper.cpp that referenced this pull request Dec 16, 2023
* expose api to let user control log output

Add
  whisper_set_log_callback()
that lets user set a callback for log messages.

Change all the
  fprintf(stderr, ...)
to call via the above.

* whisper : add <cstdarg>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants