Skip to content

Commit f55f28f

Browse files
committed
Adding basic readme
1 parent be81190 commit f55f28f

1 file changed

Lines changed: 73 additions & 3 deletions

File tree

README.md

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,74 @@
1-
stackify-api-python
2-
===================
3-
41
Stackify API for Python
2+
=======
3+
4+
[Stackify](https://stackify.com) support for Python programs.
5+
6+
```python
7+
import stackify
8+
9+
logger = stackify.getLogger()
10+
11+
try:
12+
"Make it so, #" + 1
13+
except:
14+
logger.exception("Can't add strings and numbers")
15+
```
16+
17+
## Install
18+
stackify-python can be installed through pip:
19+
```bash
20+
$ pip install -U stackify
21+
```
22+
23+
You can also check out the repository and install with setuptools:
24+
```bash
25+
$ ./setup.py install
26+
```
27+
28+
## Setup
29+
Your Stackify setup information can be provided via environment variables. For example:
30+
```bash
31+
export STACKIFY_APPLICATION=MyApp
32+
export STACKIFY_ENVIRONMENT=Dev
33+
export STACKIFY_API_KEY=******
34+
```
35+
36+
You can optionally provide your API_URL:
37+
```bash
38+
export STACKIFY_API_URL='http://myapi.stackify.com'
39+
```
40+
41+
These options can also be provided in your code:
42+
```python
43+
import stackify
44+
45+
logger = stackify.getLogger(application="MyApp", environment="Dev", api_key=******)
46+
logger.warning('Something happened')
47+
```
48+
49+
## Usage
50+
51+
Stackify can store extra data along with your log message:
52+
```python
53+
import stackify
54+
55+
logger = stackify.getLogger()
56+
57+
try:
58+
user_string = raw_input("Enter a number: ")
59+
print("You entered", int(user_string))
60+
except ValueError:
61+
logger.exception('Bad input', extra={'user entered': user_string})
62+
```
63+
64+
## Testing
65+
Run the test suite with setuptools:
66+
```bash
67+
$ ./setup.py test
68+
```
69+
70+
You can obtain a coverage report with nose:
71+
```bash
72+
$ ./setup nosetests --with-coverage --cover-package=stackify
73+
```
74+

0 commit comments

Comments
 (0)