Skip to content

Commit bd6c03e

Browse files
author
Elpedio Adoptante Jr
committed
add django logging integration
1 parent 755db35 commit bd6c03e

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
@@ -79,3 +79,45 @@ import stackify
7979

8080
logger = stackify.getLogger(basic_config=False)
8181
```
82+
83+
## Django Logging Integration
84+
85+
You can also use your existing django logging and just append stackify logging handler
86+
87+
```python
88+
LOGGING = {
89+
'version': 1,
90+
'disable_existing_loggers': False,
91+
'handlers': {
92+
'file': {
93+
'level': 'DEBUG',
94+
'class': 'logging.FileHandler',
95+
'filename': 'debug.log',
96+
},
97+
'stackify': {
98+
'level': 'DEBUG',
99+
'class': 'stackify.StackifyHandler',
100+
'application': 'MyApp',
101+
'environment': 'Dev',
102+
'api_key': '******',
103+
}
104+
},
105+
'loggers': {
106+
'django': {
107+
'handlers': ['file', 'stackify'],
108+
'level': 'DEBUG',
109+
'propagate': True,
110+
},
111+
},
112+
}
113+
```
114+
115+
Usage
116+
```python
117+
import logging
118+
119+
logger = logging.getLogger('django')
120+
121+
122+
logger.warning('Something happened')
123+
```

0 commit comments

Comments
 (0)