Added debugging

Based on log level, uses pdb