Skip to main content

A package to ease log sending to Statuscope

Project description


Source code of the Python package that is on PyPI

Install & Update

sudo pip3 install --upgrade statuscope


Here is a sample use of the package.

import argparse
import time
import sys
import random

from statuscope.logger import Logger
from statuscope.logger import LoggerConfig

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Sends logs to')
                        help='API token or task-specific token',
                        help='Task ID',
    args = parser.parse_args()

    # Create a logger configuration object and enable logs
    log_config = LoggerConfig()
    # Set the component that these logs belong to
    # Note that this is a global setting and it can be overridden on each (debug|info|warning|error|alert) call

    log_sender = Logger(args.token, args.task_id, log_config)

    # We'll generate some silly log messages because test data is usually so boring
    objects = [ 'plane', 'bike', 'book', 'icecream', 'dog' ]
    colors = [ 'yellow', 'green', 'red', 'black', 'pink', 'white' ]
    components = [ 'auth', 'backend', 'frontend', 'db', 'payment' ]
    severities = [ 'debug', 'info', 'warning', 'error', 'alert' ]

    counter = 0
    while True:
        counter = counter + 1


            severity = random.choice(severities)
            component = random.choice(components)
            color = random.choice(colors)
            object = random.choice(objects)

            if severity == 'debug':
                log_sender.debug("Log %s: I have a %s %s" % (counter, color, object), component)

            elif severity == 'info':
      "Log %s: I have a %s %s" % (counter, color, object), component)

            elif severity == 'warning':
                log_sender.warn("Log %s: I have a %s %s" % (counter, color, object), component)

            elif severity == 'error':
                log_sender.error("Log %s: I have a %s %s" % (counter, color, object), component)

            elif severity == 'alert':
                log_sender.alert("Log %s: I have a %s %s" % (counter, color, object), component)

        except KeyboardInterrupt:
            print("Ctrl-C received, exiting...")
            except Exception as e:

Then to update a log task,

python3 --token cfa0d2ed --task_id QbZJjD2u3uzFvTYAM

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for statuscope, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size statuscope-0.1.1-py3-none-any.whl (5.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size statuscope-0.1.1.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page