Skip to main content

Pre-configured file, web, and email logging for Mindscope neuropixels projects, repackaging code from AIBS mpeconfig.

Project description

For use on internal Allen Institute network

Quick start:

import logging
import np_logging

np_logging.setup()

np_logging.setup() with no arguments uses a default config, providing the loggers web and email, in addition to the default root which includes file handlers for logging.INFO and logging.DEBUG levels, plus console logging.

The built-in python logging module can then be used as normal.

Usage example:

logging.getLogger('web').info('test: web server')
logging.getLogger('email').info('test: email logger')
logging.debug('test: root logger')

ZooKeeper configs or config files can be used by supplying their path to setup():

np_logging.setup(
    '/projects/np_logging_test/defaults/logging'
)

Other input arguments to np_logging.setup():

  • project_name (default current working directory name)

  • email_address (default None)

    • if one or more addresses are supplied, an email is sent at program exit reporting the elapsed time and cause of termination. If an exception was raised, the traceback is included.
  • log_at_exit (default True)

    • If True, a message is logged when the program terminates, reporting total elapsed time.
  • email_at_exit (default False or True if email_address is not None)

    • If True, an email is sent when the program terminates.

    • If logging.ERROR, the email is only sent if the program terminates via an exception.

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

np_logging-0.2.12.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

np_logging-0.2.12-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

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