Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
User-defined logger callback, C-style.#27154
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Both functions accept C-style pointer to static functions.Both functions allow restoring the OpenCV built-in implementation by passing in a nullptr.- replaceWriteLogMessage- replaceWriteLogMessageExThis implementation is not compatible withC++ log handler objects.This implementation has minimal thread safety,in the sense that the function pointer are storedand read atomically. But otherwise, theuser-defined static functions must accept callsat all times, even after having been deregistered,because some log calls may have started beforederegistering.
c788983 to59a3fe5CompareUh oh!
There was an error while loading.Please reload this page.
1. removes addressof (&) when taking address of a function.2. added function and typedef docs
opencv-alalek left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you for contribution!
LGTM 👍
afc7c0a intoopencv:4.xUh oh!
There was an error while loading.Please reload this page.
patrikhuber commentedApr 4, 2025
@kinchungwong Is there an example somewhere of how to use this functionality, like my wishful code in#27140 (comment)? |
mshabunin commentedApr 4, 2025
@patrikhuber , I believe it works just like you've shown in the example, but the function is called |
Uh oh!
There was an error while loading.Please reload this page.
This is a competing PR, an alternative to#27140
Both functions accept C-style pointer to static functions. Both functions allow restoring the OpenCV built-in implementation by passing in a nullptr.
This implementation is not compatible with C++ log handler objects.
This implementation has minimal thread safety, in the sense that the function pointer are stored and read atomically. But otherwise, the user-defined static functions must accept calls at all times, even after having been deregistered, because some log calls may have started before deregistering.
Pull Request Readiness Checklist
See details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.