Skip to main content

ipylogging

Easy logging in Jupyter notebooks.

Most people will be fine with the default options from get_logger().

import ipylogging

logger = ipylogging.get_logger()
...
logger.debug('The nitty gritty.')
logger.info('Nice to know.')
logger.warning('It could be worse.')
logger.error("It's worse.")
logger.critical('Houston, we have a problem.')

get_logger() also takes the following options:

  • name - The name of the logger passed to logging.getLogger(). Defaults to ipylogging.
  • show_time - Whether to show the time. Defaults to True.
  • show_name - Whether to show the logger name. Defaults to False.
  • show_level - Whether to show the log level (eg. INFO, ERROR, etc.). Defaults to True.

If you want even more control, you can also use IPythonHandler directly, which is a standard logging.Handler that supports all the same stuff as logging.StreamHandler.

import logging
import ipylogging
logger = logging.getLogger('foo')
handler = ipylogging.IPythonHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.ERROR)

ipylogging also works outside of Jupyter, in which case get_logger() will simply return a normal Python logging.Logger with a StreamHandler. This is useful when writing modules that might be used inside or outside of notebooks.

Release files for ipylogging 2020.342.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipylogging 2020.342.1
File Size Uploaded
ipylogging-2020.342.1.tar.gz 3.1 kB Details

Release files / ipylogging-2020.342.1.tar.gz

Download URL ipylogging-2020.342.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16308aefd76ed848c438985902db88edc30ee77748e7f5c24508c69ea36a570e
BLAKE2b-256 checksum
How to use checksums
655a61607e4352174152f47b8dd1a3f103f24776d38c1961ace30d3b324ff40d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.2

Release history Release notifications | RSS feed

This release

2020.342.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page