Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A logging interface for Google Cloud Datastore

Project description


A logging interface for Google Cloud Datastore


Add this line to your application's requirements.txt


And then execute:

$ pip install -r requirements.txt

Or install it yourself as:

$ pip install Flask-DatastoreLogger


Using DatastoreLogger is dead simple. First set your GOOGLE_APPLICATION_CREDENTIALS environment variable to point at a valid JSON creds file.

$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/creds.json

The following snippet should get you coding

import logging
from flask import Flask
from DatastoreLogger import DatastoreLog, DatastoreLogHandler
from PubSubDecorator import PubSubDecorator

app = Flask(__name__)
app.pubsub = PubSubDecorator(app)

def run_task(message, *args, **kwargs):
    task_id = message.get('task_id')

    task_logger = logging.getLogger('task_log_{0}'.format(task_id))
    handler = DatastoreLogHandler('task_log', task_id)

    task_logger.setLevel(logging.DEBUG)'Starting Task #{0}'.format(task_id))

    # process task actions logging messages with task_logger

    return '', 200

@app.route('/task_log/<int:task_id>', methods=['GET'])
def task_log(task_id):
    log = DatastoreLog('task_log', task_id)
    return log.stream_response()


$ pytest -s --show-capture=no

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 Flask-DatastoreLogger, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size Flask-DatastoreLogger-0.0.3.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page