Skip to content

Commit af728ca

Browse files
author
Elpedio Adoptante Jr
committed
add django logging integration
1 parent 684d718 commit af728ca

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,45 @@ import stackify
9696

9797
logger = stackify.getLogger(basic_config=False)
9898
```
99+
100+
## Django Logging Integration
101+
102+
You can also use your existing django logging and just append stackify logging handler
103+
104+
```python
105+
LOGGING = {
106+
'version': 1,
107+
'disable_existing_loggers': False,
108+
'handlers': {
109+
'file': {
110+
'level': 'DEBUG',
111+
'class': 'logging.FileHandler',
112+
'filename': 'debug.log',
113+
},
114+
'stackify': {
115+
'level': 'DEBUG',
116+
'class': 'stackify.StackifyHandler',
117+
'application': 'MyApp',
118+
'environment': 'Dev',
119+
'api_key': '******',
120+
}
121+
},
122+
'loggers': {
123+
'django': {
124+
'handlers': ['file', 'stackify'],
125+
'level': 'DEBUG',
126+
'propagate': True,
127+
},
128+
},
129+
}
130+
```
131+
132+
Usage
133+
```python
134+
import logging
135+
136+
logger = logging.getLogger('django')
137+
138+
139+
logger.warning('Something happened')
140+
```

0 commit comments

Comments
 (0)