Consolidate debug/logging code into logging.c Add support for setting both debuglevel and loglevel in cn=monitor