Skip to content
Merged
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
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Stackify API for Python
=======================

## Installation
stackify-python can be installed through pip:
```bash
$ pip install -U stackify-api-python
```

**stackify-python-api** can be installed through pip:
```bash
Expand Down Expand Up @@ -75,3 +79,45 @@ import stackify

logger = stackify.getLogger(basic_config=False)
```

## Django Logging Integration

You can also use your existing django logging and just append stackify logging handler

```python
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'debug.log',
},
'stackify': {
'level': 'DEBUG',
'class': 'stackify.StackifyHandler',
'application': 'MyApp',
'environment': 'Dev',
'api_key': '******',
}
},
'loggers': {
'django': {
'handlers': ['file', 'stackify'],
'level': 'DEBUG',
'propagate': True,
},
},
}
```

Usage
```python
import logging

logger = logging.getLogger('django')


logger.warning('Something happened')
```
11 changes: 11 additions & 0 deletions docs/Developer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Testing
Run the test suite with setuptools:
```bash
$ ./setup.py test
```

You can obtain a coverage report with nose:
```bash
$ ./setup nosetests --with-coverage --cover-package=stackify
```
You might need to install the `nose` and `coverage` packages.
2 changes: 1 addition & 1 deletion stackify/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def from_record(self, record):
if k not in RECORD_VARS}

if data:
self.data = json.dumps(data, default=lambda x: x.__dict__)
self.data = json.dumps(data, default=lambda x: hasattr(x, '__dict__') and x.__dict__ or x.__str__())

if record.exc_info:
self.Ex = StackifyError()
Expand Down