I have third party library which calls an macro for logging. Inside that macro they are using fprintf for logging.
I am thinking about modifying the code to define a custom callback for logging, but I am not sure what will be best way.
Solution I want is:
- User can define a callback for logging.
- If callback is not define use fprint.
So I am looking for some type of static function with default definition which I can override if I want.
What will be the best way of doing this ?
As we can’t overload static function so everyone needs to define their definition of the logging function.
Something like this:
should work. The
...represent your logging arguments, which of course could be var-args using that real...C syntax, but doesn’t have to be. All depends on what your logging is.