Skip to main content

UNKNOWN

Project description

The zc.loggermonitor package provides a zc.monitor plugin for getting and setting logger levels.

>>> import sys, zc.loggermonitor

It is an error to call the monitor without user arguments.

>>> zc.loggermonitor.level(sys.stdout)
Traceback (most recent call last):
...
TypeError: level() takes at least 2 arguments (1 given)

If you pass it a logger name, it returns the current effective level:

>>> zc.loggermonitor.level(sys.stdout, '.')
NOTSET
>>> zc.loggermonitor.level(sys.stdout, 'mylogger')
NOTSET

If you pass a level it sets the level:

>>> zc.loggermonitor.level(sys.stdout, '.', 'INFO')
>>> zc.loggermonitor.level(sys.stdout, '.')
INFO
>>> zc.loggermonitor.level(sys.stdout, 'mylogger')
INFO

You can also pass a numeric value:

>>> zc.loggermonitor.level(sys.stdout, 'mylogger', '5')
>>> zc.loggermonitor.level(sys.stdout, '.')
INFO
>>> zc.loggermonitor.level(sys.stdout, 'mylogger')
Level 5
>>> zc.loggermonitor.level(sys.stdout, 'mylogger', '10')
>>> zc.loggermonitor.level(sys.stdout, '.')
INFO
>>> zc.loggermonitor.level(sys.stdout, 'mylogger')
DEBUG
>>> zc.loggermonitor.level(sys.stdout, 'mylogger', 'NOTSET')
>>> zc.loggermonitor.level(sys.stdout, '.')
INFO
>>> zc.loggermonitor.level(sys.stdout, 'mylogger')
INFO
>>> zc.loggermonitor.level(sys.stdout, '.', 'NOTSET')
>>> zc.loggermonitor.level(sys.stdout, '.')
NOTSET
>>> zc.loggermonitor.level(sys.stdout, 'mylogger')
NOTSET

Download

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

zc.loggermonitor-0.1.tar.gz (2.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page