This repository was archived by the owner on Dec 8, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLogActivity.py
More file actions
40 lines (29 loc) · 1.34 KB
/
LogActivity.py
File metadata and controls
40 lines (29 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import logging
logger = logging.getLogger('ActivityLogger')
hdlr = logging.FileHandler('../logs/Activity.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)
# I'm not logging the auth attempt as it might be
# close to a real credential, allowing someone to guess it
def logBadCredentials(username):
logger.info("Bad AuthenticationAttempt : "+username)
def logTooManyLoginAttempts(username):
logger.info("TooManyLoginAttempts : "+username)
def logMissingSession(session_id):
logger.info("Session id missing : "+session_id)
def logTimeout(session_id):
logger.info("Session id timed out : "+session_id)
def logFeedback(session_id):
logger.info("Feedback submitted : "+session_id)
def logSessionBegin(username,session_id):
logger.info("SessionBegins : "+username+" : "+session_id)
def logPageTurn(session_id,page):
logger.info("PageTurn : "+session_id+" : "+page)
def logSearchBegun(session_id,psc_pattern,search_string):
logger.info("SearchBegun : "+session_id+" : "+str(psc_pattern)+" : "+str(search_string))
def logSearchDone(session_id,psc_pattern,search_string):
logger.info("SearchDone : "+session_id+" : "+str(psc_pattern)+" : "+str(search_string))
def logDebugInfo(info):
logger.info("Debug Info : "+info)