Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Since every framework deals with setting headers slightly differently the librar
The library includes a middleware for using with Django. All you have to do is in your ``settings.py`` file make sure to update your list of middleware and add

```python
MIDDLEWARE_CLASSES = (
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10
'chromelogger.DjangoMiddleware'
)
]
```

After that you can import the chromelogger class from any file in your application and add logs.
Expand Down Expand Up @@ -74,7 +74,7 @@ For using chromelogger with Flask, you can use a custom response-handler like th

if app.debug:
import chromelogger as console

@app.after_request
def chromelogger(response):
header = console.get_header()
Expand Down
8 changes: 7 additions & 1 deletion chromelogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ def table(*args):
_log(args)


try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object


# this is middleware for django. ater this module is installed just add
# "chromelogger.DjangoMiddleware" to your MIDDLEWARE_CLASSES in settings.py
#
Expand All @@ -160,7 +166,7 @@ def table(*args):
# chromelogger.log('Hello world!')
#
# from anywhere in your Django application
class DjangoMiddleware(object):
class DjangoMiddleware(MiddlewareMixin):
def process_response(self, request, response):
header = get_header()
if header is not None:
Expand Down