Skip to content

Commit a7764a2

Browse files
author
Darin Howard
committed
Updated default logging level to INFO. Updated license. Adding environment to logging post data. Updating readme instructions.
1 parent c5773b6 commit a7764a2

7 files changed

Lines changed: 83 additions & 58 deletions

File tree

LICENSE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Stackify Python API LICENSE
2+
---
3+
4+
Certain inventions disclosed in this file may be claimed within patents owned or patent applications filed by
5+
Stackify, LLC (“Stackify”) or third parties.
6+
7+
Stackify grants you a revocable, non-exclusive, non-transferable, limited license to download, install and use this
8+
Stackify Python API package (“Application”) strictly in accordance with the terms of this Agreement and the terms found
9+
at https://stackify.com/terms-conditions.
10+
11+
You agree not to, and you will not permit others to: license, sell, rent, lease, assign, distribute, transmit, host,
12+
outsource, disclose or otherwise commercially exploit the Application or make the Application available to any third
13+
party; modify, make derivative works of, disassemble, decrypt, reverse compile or reverse engineer any part of the
14+
Application; or remove, alter or obscure any proprietary notice (including any notice of copyright or trademark) of
15+
Stackify or its affiliates, partners, suppliers or the licensors of the Application.
16+
17+
You may install, execute, and distribute these files and their contents only in conjunction with your direct use of
18+
Stackify’s services. These files and their contents shall not be used in conjunction with any other product or
19+
software, including but not limited to those that may compete with any Stackify product, feature, or software. As a
20+
condition to the foregoing grant, you must provide this notice along with each copy you distribute and you must not
21+
remove, alter, or obscure this notice.
22+
23+
The Application, including without limitation all copyrights, patents, trademarks, trade secrets and other intellectual
24+
property rights are, and shall remain, the sole and exclusive property of Stackify. Any feedback, comments, ideas,
25+
code, pull requests, improvements or suggestions (collectively, "Suggestions") provided by you to Stackify with respect
26+
to the Application shall remain the sole and exclusive property of Stackify. Stackify shall be free to use, copy,
27+
modify, publish, or redistribute the Suggestions for any purpose and in any way without any credit or any compensation
28+
to you.
29+
30+
Stackify reserves the right to modify, suspend or discontinue, temporarily or permanently, the Application or any
31+
service to which it connects, with or without notice and without liability to you.
32+
33+
Stackify may from time to time provide enhancements or improvements to the features/functionality of the Application,
34+
which may include patches, bug fixes, updates, upgrades and other modifications ("Updates"). Updates may modify or
35+
delete certain features and/or functionalities of the Application. You agree that Stackify has no obligation to (i)
36+
provide any Updates, or (ii) continue to provide or enable any particular features and/or functionalities of the
37+
Application to you. You further agree that all Updates will be (i) deemed to constitute an integral part of the
38+
Application, and (ii) subject to the terms and conditions of this Agreement.
39+
40+
All other use, reproduction, modification, distribution, or other exploitation of these files is strictly prohibited,
41+
except as may be set forth in a separate written license agreement between you and Stackify. The terms of any such
42+
license agreement will control over this notice. The license stated above will be automatically terminated and
43+
revoked if you exceed its scope or violate any of the terms of this notice.
44+
45+
Upon termination of this Agreement, you shall cease all use of the Application and delete all copies of the
46+
Application from your mobile device or from your computer.
47+
48+
Termination of this Agreement will not limit any of Stackify LLC's rights or remedies at law or in equity in case of
49+
breach by you (during the term of this Agreement) of any of your obligations under the present Agreement.
50+
51+
You agree to indemnify and hold Stackify LLC and its parents, subsidiaries, affiliates, officers, employees, agents,
52+
partners and licensors (if any) harmless from any claim or demand, including reasonable attorneys' fees, due to or
53+
arising out of your: (a) use of the Application; (b) violation of this Agreement or any law or regulation; or (c)
54+
violation of any right of a third party.
55+
56+
Unless otherwise expressly agreed by Stackify in a separate written license agreement, these files are provided
57+
AS IS, WITHOUT WARRANTY OF ANY KIND, including without any implied warranties of MERCHANTABILITY, FITNESS FOR A
58+
PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT. As a condition to your use of these files, you are solely responsible
59+
for such use. Stackify will have no liability to you for direct, indirect, consequential, incidental, special, or
60+
punitive damages or for lost profits or data.
61+
62+

LICENSE.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,46 @@
11
Stackify API for Python
22
=======================
33

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-
174
## Installation
18-
stackify-python can be installed through pip:
19-
```bash
20-
$ pip install -U stackify
21-
```
225

23-
You can also check out the repository and install with setuptools:
6+
**stackify-python-api** can be installed through pip:
247
```bash
25-
$ ./setup.py install
8+
$ pip install stackify-api-python
269
```
2710

2811
## Configuration
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-
```
3512

36-
These options can also be provided in your code:
13+
14+
#### Standard API
3715
```python
38-
# Standard API
3916
import stackify
40-
41-
logger = stackify.getLogger(application="MyApp", environment="Dev", api_key=******)
17+
logger = stackify.getLogger(application="Python Application", environment="Production", api_key="***")
4218
logger.warning('Something happened')
4319
```
4420

21+
#### Python Logging Integration
22+
4523
```python
46-
# Python Logging Integration
4724
import logging
4825
import stackify
49-
50-
# your existing logging
5126
logger = logging.getLogger()
52-
...
53-
54-
stackify_handler = stackify.StackifyHandler(application="MyApp", environment="Dev", api_key=******)
27+
stackify_handler = stackify.StackifyHandler(application="Python Application", environment="Production", api_key="***")
5528
logger.addHandler(stackify_handler)
56-
5729
logger.warning('Something happened')
5830
```
5931

32+
#### Environment Settings
33+
34+
```bash
35+
export STACKIFY_APPLICATION=Python Application
36+
export STACKIFY_ENVIRONMENT=Production
37+
export STACKIFY_API_KEY=******
38+
```
39+
40+
6041
## Usage
6142

62-
stackify-python handles uploads in batches of 100 messages at a time on another thread.
43+
**stackify-python-api** handles uploads in batches of 100 messages at a time on another thread.
6344
When your program exits, it will shut the thread down and upload the remaining messages.
6445

6546
Stackify can store extra data along with your log message:
@@ -74,7 +55,6 @@ except ValueError:
7455
You can also name your logger instead of using the automatically generated one:
7556
```python
7657
import stackify
77-
7858
logger = stackify.getLogger('mymodule.myfile')
7959
```
8060

@@ -84,7 +64,6 @@ This library has an internal logger it uses for debugging and messaging.
8464
For example, if you want to enable debug messages:
8565
```python
8666
import logging
87-
8867
logging.getLogger('stackify').setLevel(logging.DEBUG)
8968
```
9069

@@ -96,16 +75,3 @@ import stackify
9675

9776
logger = stackify.getLogger(basic_config=False)
9877
```
99-
100-
## Testing
101-
Run the test suite with setuptools:
102-
```bash
103-
$ ./setup.py test
104-
```
105-
106-
You can obtain a coverage report with nose:
107-
```bash
108-
$ ./setup nosetests --with-coverage --cover-package=stackify
109-
```
110-
You might need to install the `nose` and `coverage` packages.
111-

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exclude =
99
venv*,
1010
setup.cfg,
1111
README.md,
12-
LICENSE.txt,
12+
LICENSE.md,
1313
requirements.txt,
1414

1515

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
author_email='[email protected]',
2424
packages=['stackify'],
2525
url='https://github.com/stackify/stackify-api-python',
26-
license=open('LICENSE.txt').readline(),
2726
description='Stackify API for Python',
2827
long_description=read_md('README.md'),
29-
download_url='https://github.com/stackify/stackify-api-python/tarball/0.0.1',
3028
keywords=['logging', 'stackify', 'exception'],
3129
classifiers=["Programming Language :: Python"],
3230
install_requires=[

stackify/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
logging.DEBUG: 'DEBUG',
1919
logging.NOTSET: 'NOTSET'
2020
}
21-
DEFAULT_LEVEL = logging.ERROR
21+
DEFAULT_LEVEL = logging.INFO

stackify/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def identify_application(self):
8282

8383
@retrying.retry(wait_exponential_multiplier=1000, stop_max_delay=10000)
8484
def send_log_group(self, group):
85+
group.Env = self.environment_detail.configuredEnvironmentName
8586
group.CDID = self.device_id
8687
group.CDAppID = self.device_app_id
8788
group.AppNameID = self.app_name_id
88-
group.ServerName = self.device_alias
8989
group.ServerName = group.ServerName or self.environment_detail.deviceName
9090
self.POST(LOG_SAVE_URL, group, True)

0 commit comments

Comments
 (0)