Refactor logger; add env var to set log_level