Skip to content

Commit

Permalink
Merge pull request #1125 from karlcow/719/1
Browse files Browse the repository at this point in the history
Fixes #719. Adds tracking ip logs
  • Loading branch information
Mike Taylor authored Jul 11, 2016
2 parents 240fe46 + 70eecd8 commit a0e5ce3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
# app.logger.info(Thing_To_Log)
# it will create a line with the following format
# 2015-09-14 20:50:19,185 INFO: Thing_To_Log [in /codepath/views.py:127]

LOG_FILE = '/tmp/webcompat.log'
LOG_FMT = '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
LOG_FMT = '%(asctime)s tracking %(message)s'

# Status categories used in the project
# 'new', 'needsdiagnosis', 'needscontact', 'contactready' , 'sitewait', 'close'
Expand Down
6 changes: 6 additions & 0 deletions webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import json
import logging
import urllib

from flask import abort
Expand Down Expand Up @@ -159,6 +160,11 @@ def create_issue():
# copy the form so we can add the full UA string to it.
form = request.form.copy()
form['ua_header'] = request.headers.get('User-Agent')
# Logging the ip and url for investigation
log = app.logger
log.setLevel(logging.INFO)
log.info('{ip} {url}'.format(ip=request.remote_addr, url=form['url']))
# form submission for 3 scenarios: authed, to be authed, anonymous
if form.get('submit-type') == AUTH_REPORT:
if g.user: # If you're already authed, submit the bug.
response = report_issue(form)
Expand Down

0 comments on commit a0e5ce3

Please sign in to comment.