Parameterize log levels and log formats

I am asking for this to be merged because there are several log-level related fixed on master than depend on this patch.