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')
-
user configs should be specified according to the python logging library dict schema
-
the default config is fetched from the ZooKeeper server
eng-mindscope:2181
-
configs can be added via ZooNavigator webview: http://eng-mindscope:8081
-
or more conveniently, via an extension for VSCode such as gaoliang.visual-zookeeper
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)- sets the
channel
value for the web logger - the web log can be viewed at http://eng-mindscope:8080
- sets the
-
email_address
(defaultNone
)- 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
(defaultTrue
)- If
True
, a message is logged when the program terminates, reporting total elapsed time.
- If
-
email_at_exit
(defaultFalse
orTrue
ifemail_address
is notNone
)-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for np_logging-0.2.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83ffe9fb2ca6a437392c9d61bed1a1b5e4b88970ef3413b93b8984a8ddc9fdf5 |
|
MD5 | b5ff38ff2f1576e17f99a12ea4165424 |
|
BLAKE2b-256 | c54a9d8fee58a791951172aaae91d67b02412cbb62ab11c8ea132840a307758c |