improve logging mechanism