new debug trace infrastructure

New configuration option DEBUG_LEVEL
New event PKG_EVENT_DEBUG
New emitter pkg_debug