I've written my own similar schemes in the past but in all cases I made sure the log-level required was settable in a config file readable by the program. So starting with "no logging", if you encounter a problem you change the config file's log-level and send the program a signal or, in the worst case if the program can't (or wasn't designed to) handle signals, stop it and restart to force it to re-read the config file. This way you only log verbosely when you need to and you don't need to re-compile/re-link to turn logging on.
I've written my own similar schemes in the past but in all cases I made sure the log-level required was settable in a config file readable by the program. So starting with "no logging", if you encounter a problem you change the config file's log-level and send the program a signal or, in the worst case if the program can't (or wasn't designed to) handle signals, stop it and restart to force it to re-read the config file. This way you only log verbosely when you need to and you don't need to re-compile/re-link to turn logging on.