core: Import of logging.[ch] from GnuPG
Taken from GnuPG master commit 98c260e057e7829580da99f0c8e0037a3896bfae