Improve logging management

Drop the use of global var
Drop the string formatting using % or format, letting logging module format strings only if logging level requires it.