File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- stackify-api-python
2- ===================
3-
41Stackify 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+
You can’t perform that action at this time.
0 commit comments