Corey Morris
commited on
Commit
·
d96fdf9
1
Parent(s):
68bce52
Changed error logging from print statements to logger. It is not currently working to save to a file locally
Browse files- result_data_processor.py +7 -2
result_data_processor.py
CHANGED
|
@@ -4,10 +4,15 @@ import fnmatch
|
|
| 4 |
import json
|
| 5 |
import re
|
| 6 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
class ResultDataProcessor:
|
| 9 |
|
|
|
|
| 10 |
def __init__(self, directory='results', pattern='results*.json'):
|
|
|
|
| 11 |
self.directory = directory
|
| 12 |
self.pattern = pattern
|
| 13 |
self.data = self.process_data()
|
|
@@ -108,8 +113,8 @@ class ResultDataProcessor:
|
|
| 108 |
organization_names.append(organization_name)
|
| 109 |
dataframes.append(cleaned_data)
|
| 110 |
except Exception as e:
|
| 111 |
-
|
| 112 |
-
|
| 113 |
continue
|
| 114 |
|
| 115 |
|
|
|
|
| 4 |
import json
|
| 5 |
import re
|
| 6 |
import numpy as np
|
| 7 |
+
import logging
|
| 8 |
+
|
| 9 |
+
logging.basicConfig(filename='error_log.log', level=logging.ERROR)
|
| 10 |
|
| 11 |
class ResultDataProcessor:
|
| 12 |
|
| 13 |
+
|
| 14 |
def __init__(self, directory='results', pattern='results*.json'):
|
| 15 |
+
|
| 16 |
self.directory = directory
|
| 17 |
self.pattern = pattern
|
| 18 |
self.data = self.process_data()
|
|
|
|
| 113 |
organization_names.append(organization_name)
|
| 114 |
dataframes.append(cleaned_data)
|
| 115 |
except Exception as e:
|
| 116 |
+
logging.error(f'Error processing {filename}')
|
| 117 |
+
logging.error(f'The error is: {e}')
|
| 118 |
continue
|
| 119 |
|
| 120 |
|