aboutsummaryrefslogtreecommitdiff
path: root/store.py
diff options
context:
space:
mode:
Diffstat (limited to 'store.py')
-rw-r--r--store.py42
1 files changed, 33 insertions, 9 deletions
diff --git a/store.py b/store.py
index b3ada45..3f3718f 100644
--- a/store.py
+++ b/store.py
@@ -176,15 +176,28 @@ class ReportStore:
176 }) 176 })
177 177
178 def log_http_request(self, method, url, body, headers, response): 178 def log_http_request(self, method, url, body, headers, response):
179 self.add_log({ 179 if isinstance(response, Exception):
180 "type": "http_request", 180 self.add_log({
181 "method": method, 181 "type": "http_request",
182 "url": url, 182 "method": method,
183 "body": body, 183 "url": url,
184 "headers": headers, 184 "body": body,
185 "status": response.status_code, 185 "headers": headers,
186 "response": response.text 186 "status": -1,
187 }) 187 "response": None,
188 "error": response.__class__.__name__,
189 "error_message": str(response),
190 })
191 else:
192 self.add_log({
193 "type": "http_request",
194 "method": method,
195 "url": url,
196 "body": body,
197 "headers": headers,
198 "status": response.status_code,
199 "response": response.text
200 })
188 201
189 def log_error(self, action, message=None, exception=None): 202 def log_error(self, action, message=None, exception=None):
190 self.print_log("[Error] {}".format(action)) 203 self.print_log("[Error] {}".format(action))
@@ -209,6 +222,17 @@ class ReportStore:
209 "action": action, 222 "action": action,
210 }) 223 })
211 224
225 def log_market(self, args, user_id, market_id, report_path, debug):
226 self.add_log({
227 "type": "market",
228 "commit": "$Format:%H$",
229 "args": vars(args),
230 "user_id": user_id,
231 "market_id": market_id,
232 "report_path": report_path,
233 "debug": debug,
234 })
235
212class BalanceStore: 236class BalanceStore:
213 def __init__(self, market): 237 def __init__(self, market):
214 self.market = market 238 self.market = market