Skip to main content

mms-alice-python-logger

Log Module for MMS/Alice standarzised log purposes

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

How to use:

1. The following dependencies are required:

mms-python-logger>=0.0.1

2. Import module:

from mms_alice_python_logger_pkg.alice_log_handler import Logger

Please also add the following to the requirements.txt:

google-cloud-logging==1.8.0
mms-python-logger>=0.0.2

3. 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')

The following resource_types are supported:

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

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

4. Use the logger:

logger.info('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

Important

This log tool only works in App Engine Standard/Flexible and Cloud Function 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 "app.py" file. From there every log entry will be written - Modules used within app.py need to return the exceptions to the caller so error etc. get logged at one central point within app.py.

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.3.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mms_python_logger-0.0.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file mms_python_logger-0.0.3.tar.gz.

File metadata

  • Download URL: mms_python_logger-0.0.3.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for mms_python_logger-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d277b1ac0f8e2679dfd265479bf53ce9cfe120a6a7c726c9309491f899640633
MD5 bcc60b75d538d09f62b13ac5af3d5adc
BLAKE2b-256 d8c38aece89fd9685867757e71ae35c0972b5dd24f7902418c7653b3065c317e

See more details on using hashes here.

File details

Details for the file mms_python_logger-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: mms_python_logger-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for mms_python_logger-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5ba1e1e500c89e1de754ab363def03da1a7e7596640e0a4bb5863cf1b6ebd310
MD5 4394e1805582b4d4bfd66d621c04207d
BLAKE2b-256 f9a0d3dd052c64761b1d664d3bdb7c314da84b4c8d3b18e7edae2e590656e7d7

See more details on using hashes here.

Supported by

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