Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit f14ca27

Browse files
committed
Create audit object class
1 parent 8e46644 commit f14ca27

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

market/audit.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
__author__ = 'hoffmabc'
2+
3+
from log import Logger
4+
5+
6+
class Audit(object):
7+
"""
8+
A class for handling audit information
9+
"""
10+
11+
def __init__(self, db):
12+
self.db = db
13+
14+
self.log = Logger(system=self)
15+
16+
self.action_ids = {
17+
"GET_PROFILE": 0,
18+
"GET_CONTRACT": 1,
19+
"GET_LISTINGS": 2, # Click Store tab
20+
"GET_FOLLOWING": 3,
21+
"GET_FOLLOWERS": 4,
22+
"GET_RATINGS": 5
23+
}
24+
25+
def record(self, guid, action_id, contract_hash=None):
26+
self.log.info("Recording Audit Event [%s]" % action_id)
27+
28+
if action_id in self.action_ids:
29+
self.db.audit_shopping.set(guid, self.action_ids[action_id], contract_hash)
30+
else:
31+
self.log.error("Could not identify this action id")

0 commit comments

Comments
 (0)