[Refactor] - 1. Add log function in pandora.py 2. Refactor the logic of d1.py