adding configurable logging levels and fixing logging bug