Standardized error handling

Categorized errors as DEBUG, INFO, WARNING, or ERROR, and wrote utility function to standardize error output format.