Stackify API for Python
Project description
Stackify API for Python
Installation
stackify-python-api can be installed through pip:
$ pip install stackify-api-python
Configuration
Standard API
import stackify
logger = stackify.getLogger(application="Python Application", environment="Production", api_key="***")
logger.warning('Something happened')
Python Logging Integration
import logging
import stackify
logger = logging.getLogger()
stackify_handler = stackify.StackifyHandler(application="Python Application", environment="Production", api_key="***")
logger.addHandler(stackify_handler)
logger.warning('Something happened')
Environment Settings
export STACKIFY_APPLICATION=Python Application
export STACKIFY_ENVIRONMENT=Production
export STACKIFY_API_KEY=******
Usage
stackify-python-api handles uploads in batches of 100 messages at a time on another thread. When your program exits, it will shut the thread down and upload the remaining messages.
Stackify can store extra data along with your log message:
try:
user_string = raw_input("Enter a number: ")
print("You entered", int(user_string))
except ValueError:
logger.exception('Bad input', extra={'user entered': user_string})
You can also name your logger instead of using the automatically generated one:
import stackify
logger = stackify.getLogger('mymodule.myfile')
Internal Logger
This library has an internal logger it uses for debugging and messaging. For example, if you want to enable debug messages:
import logging
logging.getLogger('stackify').setLevel(logging.DEBUG)
By default, it will enable the default logging settings via logging.basicConfig()
and print WARNING
level messages and above. If you wish to set everything up yourself,
just pass basic_config=False
in getLogger
:
import stackify
logger = stackify.getLogger(basic_config=False)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for stackify-api-python-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31fa4fa3f5668c51c81b2d80298163041165e018f6c3c13460fbca488e47de12 |
|
MD5 | 73ba1ff0064a88c605bb81b457c5ad92 |
|
BLAKE2b-256 | 7cd61633ebd3fa6e5e6d2d0c5d043365c9d554442277db060b0ca568f13eb253 |
Hashes for stackify_api_python-1.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 768c268533abbf9d0813d9debd15bddfa88e540c25556cd0c932bd8d53ca3c5f |
|
MD5 | ff8d7a380778d78298473399005ad4a5 |
|
BLAKE2b-256 | 7a51c1b3adbd5074968b5cfe62ee3a929e10feb7c008f0d0d5f8ac8b179c50f6 |