Skip to content

Commit e4c7703

Browse files
committed
some fixes and sentry logging
1 parent d21044b commit e4c7703

File tree

5 files changed

+49
-32
lines changed

5 files changed

+49
-32
lines changed

hsmapper/core/templates/home.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@
271271
optime: index}
272272
d[type] = value; // type = opening or closing
273273

274+
var that = this;
274275
$.ajax({
275276
url: "{% url 'api-edit-hospital' 1 %}".replace("1", globals.selectedFeature.attributes.id),
276277
type: "post",
@@ -281,6 +282,8 @@
281282
}
282283
else {
283284
alert_msg("{% trans "Error :(" %}", "error");
285+
console.log(that);
286+
$(that).text("00:00");
284287
}
285288
$("#updated_by").text(globals.username);
286289
}

hsmapper/core/templates/hospital_info.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% load i18n core_filters %}
2-
2+
{% testforsentry %}
33
{% if hospital %}
44
{% if not hospital.expiration|is_still_valid %}
55
<div id="expired_alert" class="alert-message error">{% trans "Warning! Data is expired" %}</div>

hsmapper/core/views/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_hospitals(request):
2424
geojson_output = geoj.encode(djf.decode(qs))
2525
response = HttpResponse(mimetype="application/json")
2626
response.write(geojson_output)
27-
27+
raise ValueError
2828
return response
2929

3030

hsmapper/settings.py

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
DISPLAY_SRID = 900913
1414

1515
DEBUG = True
16-
TEMPLATE_DEBUG = DEBUG
16+
TEMPLATE_DEBUG = True
1717

1818
ADMINS = (
1919
# ('Your Name', '[email protected]'),
@@ -108,7 +108,6 @@
108108
'django.contrib.messages.middleware.MessageMiddleware',
109109
'reversion.middleware.RevisionMiddleware',
110110
'sentry.client.middleware.Sentry404CatchMiddleware',
111-
'sentry.client.middleware.SentryResponseErrorIdMiddleware',
112111
)
113112

114113
ROOT_URLCONF = 'hsmapper.urls'
@@ -138,36 +137,10 @@
138137
'django_extensions',
139138

140139
# sentry
141-
'indexer',
142-
'paging',
143140
'sentry',
144-
'sentry.client',
141+
'raven.contrib.django',
145142
)
146143

147-
# A sample logging configuration. The only tangible logging
148-
# performed by this configuration is to send an email to
149-
# the site admins on every HTTP 500 error.
150-
# See http://docs.djangoproject.com/en/dev/topics/logging for
151-
# more details on how to customize your logging configuration.
152-
LOGGING = {
153-
'version': 1,
154-
'disable_existing_loggers': False,
155-
'handlers': {
156-
'mail_admins': {
157-
'level': 'ERROR',
158-
'class': 'django.utils.log.AdminEmailHandler'
159-
}
160-
},
161-
'loggers': {
162-
'django.request': {
163-
'handlers': ['mail_admins'],
164-
'level': 'ERROR',
165-
'propagate': True,
166-
},
167-
}
168-
}
169-
170-
171144
TEMPLATE_CONTEXT_PROCESSORS = (
172145
"django.contrib.auth.context_processors.auth",
173146
"django.core.context_processors.debug",
@@ -178,4 +151,44 @@
178151
"django.core.context_processors.csrf",
179152
)
180153

181-
ACCOUNT_ACTIVATION_DAYS = 2
154+
LOGGING = {
155+
'version': 1,
156+
'disable_existing_loggers': True,
157+
'root': {
158+
'level': 'WARNING',
159+
'handlers': ['sentry'],
160+
},
161+
'formatters': {
162+
'verbose': {
163+
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
164+
},
165+
},
166+
'handlers': {
167+
'sentry': {
168+
'level': 'ERROR',
169+
'class': 'raven.contrib.django.handlers.SentryHandler',
170+
},
171+
'console': {
172+
'level': 'DEBUG',
173+
'class': 'logging.StreamHandler',
174+
'formatter': 'verbose'
175+
}
176+
},
177+
'loggers': {
178+
'django.db.backends': {
179+
'level': 'ERROR',
180+
'handlers': ['console'],
181+
'propagate': False,
182+
},
183+
'raven': {
184+
'level': 'DEBUG',
185+
'handlers': ['console'],
186+
'propagate': False,
187+
},
188+
'sentry.errors': {
189+
'level': 'DEBUG',
190+
'handlers': ['console'],
191+
'propagate': False,
192+
},
193+
},
194+
}

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ django-extensions==0.7.1
66
South==0.7.3
77
django-reversion==1.5.1
88
django-ajaxutils==0.1.1
9+
raven==0.7.1
910
django-sentry==1.13.5

0 commit comments

Comments
 (0)