Skip to main content

A custom MMS/Alice log module for python

Project description


Log Module for MMS/Alice standarzised log purposes

This is a package for writing logs to GCP App Engine.

How to use:

1. Import module:

from mms_alice_python_logger_pkg.alice_log_handler import Logger

Please also add the following to the requirements.txt or install the pip packages on your VM:


2. Initalize the logger:

Cloud Function Logging:

logger = Logger(run_id, project_id, function_name, resource_type)
logger = Logger(run_id='lksjdf2', project_id='my-project-id', function_name='ppx-price-updates-de-gcs-bq', resource_type='cloud_function')

App Engine Logging:

logger = Logger(run_id, project_id, module_id, version_id, resource_type)
logger = Logger(run_id='lksjdfl98', project_id='v135-5683-alice-ksk-explore', module_id='app-flex-sample-service', version_id='v0.0.1', resource_type='gae_app')

Compute Engine:

logger = Logger(run_id, project_id, resource_type)
logger = Logger(run_id='lksjdfl98', project_id='v135-5683-alice-ksk-explore', resource_type='gce_instance')

The following resource_types are supported:

Cloud Function: 'cloud_function' App Engine: 'gae_app' Compute Engine: 'gce_instance'

When resource type is unrecoginzable logs will be processed to 'Global'

3. Use the logger:'your message')
logger.warning('your message')
logger.error('your message')
logger.critical('your message')
logger.debug('your message')

The logs are visible in Stackdriver Logging via GAE Application -> Module_id -> Version_id for App Engine. Or under Cloudfunctions -> Function_id Or under GCE VM Instance -> Instance_id


This log tool only works in App Engine Standard/Flexible, Cloud Function and Compute Engine environment.

For local testing do not initialize the logger as it would ran into errors because of the missing GCP context.

How we log

We initialize the logger only in the "" file. From there every log entry will be written - Modules used within need to return the exceptions to the caller so error etc. get logged at one central point within

Project details

Download files

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

Source Distribution

mms_python_logger-0.0.4.tar.gz (2.8 kB view hashes)

Uploaded source

Built Distribution

mms_python_logger-0.0.4-py3-none-any.whl (5.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page