Skip to main content

Stackify API for Python

Installation

stackify-python can be installed through pip:

$ pip install -U stackify-api-python

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(__name__)
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
logger = logging.getLogger('stackify')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.FileHandler('stackify.log'))  # or any handler you want

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)

Django Logging Integration

You can also use your existing django logging and just append stackify logging handler

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': 'debug.log',
        },
        'stackify': {
            'level': 'DEBUG',
            'class': 'stackify.StackifyHandler',
            'application': 'MyApp',
            'environment': 'Dev',
            'api_key': '******',
        }
    },
    'loggers': {
        'django': {
            'handlers': ['file', 'stackify'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}

Usage

import logging

logger = logging.getLogger('django')


logger.warning('Something happened')

Real User Monitoring (RUM)

Real user monitoring injects a script tag containing the RUM JS that is responsible for capturing information about the http requests on the browser. This approach is manual and needs to be configured.

RUM - Setup

# Configuration - Standard API
logger = stackify.getLogger(..., rum_key="YourRumKey")
# or Configuration - Python Logging Integration
stackify.StackifyHandler(..., rum_key="YourRumKey")

# Use this to apply on views
import stackify.rum

stackify.rum.insert_rum_script()

Release files for stackify-api-python 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stackify-api-python 1.2.0
File Size Uploaded
stackify-api-python-1.2.0.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stackify-api-python 1.2.0
File Interpreter ABI Platform
stackify_api_python-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.2 kB

Release files / stackify-api-python-1.2.0.tar.gz

Download URL stackify-api-python-1.2.0.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fba312634b9dced650587dd0ee47b02b805ef470b96776d23cb7c9fc44280888
BLAKE2b-256 checksum
How to use checksums
b149f212d6d89063fab613161c81c016d83c3de5be093d99445aadb71e127e2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.21.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.2.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.7

Release files / stackify_api_python-1.2.0-py3-none-any.whl

Download URL stackify_api_python-1.2.0-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73ab9f4d19ae67138cab815e9530721ad3044474077a8825cf7e6987c845411b
BLAKE2b-256 checksum
How to use checksums
2a8f1f0537c37998308a4b881fe7dfcb4cefccfc58715effda81b16afdc35b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.21.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.2.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.7

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page