This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

magiclog simplifies application and library logging, allowing you to use loggers where you would use print statements without complicated setup or logger discovery.

from magiclog import log


def main():
    log.configure()
    log.info('Hello, INFO.')


if __name__ == '__main__':
    main()

magiclog tunes the logging config in a way that’s friendlier than the logging module’s basic config, without asking any more work from the library author:

  • from magiclog import log retrieves the logger for your application, using a little meta-programming, obviating the need to figure whether you should use __package__, __name__ or the sys.argv[0].
  • When you’re running your task in the background, magiclog recognizes this and logs to Syslog; otherwise it logs to stderr.
  • magiclog provides a simply one-line format for stderr, with the time and a message, but can also log in an extended format, with logging and level, when requested. And magiclog always includes this information when logging to Syslog.

magiclog only arranges to log at all when you call log.configure(). If you’d like to customize levels, you can explicitly pass them to log.configure() with the level=..., syslog=... and stderr=... named parameters. Otherwise, your logger has a null handler, as described in Configuring Logging for a Library

log.configure()

# Same as the above.
log.configure(level='info')

# Use Syslog or stderr based on whether or not we're in the foreground,
# but at debug level instead of info level.
log.configure(level='debug')

# Enables both channels, whether foregrounded or backgrounded.
log.configure(syslog='info', stderr='info')

# Enables the more verbose console logging format, with module and function
# name information as well as time.
log.configure(level='info', extended=True)

Configuring Other Modules’ Loggers

The logger function in magiclog provides for logger discovery, walking the stack and using the module or package name, or the name of the running executable, depending on the situation. You can use logger to retrieve and configure the loggers of other modules, too, following the same rules as your application logger.

import magiclog
from magiclog import log


def main():
    # You can pass a module object or a string to ``logger``. Here, we
    # configure magiclog's own (usually not very useful) logger.
    magiclog.logger(magiclog).configure()
    # Obtain a reference to Boto3's logger and auto-configure it. The
    # logger for ``magiclog`` will print out a few things as it sets this
    # logger up.
    magiclog.logger('boto3').configure()
    log.configure()
    log.info('Hello, INFO.')


if __name__ == '__main__':
    main()
Release History

Release History

1.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.99.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.99.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.99.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
magiclog-1.0.2.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Oct 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting