Simple logger for use in Jupyter notebooks.
This package sets up the Pyhton logger
for immediate use in a Jupyter notebook setting.
Install as: pip install ou-logger
Usage:
# Variously:
from ou_logger import logger
from ou_logger import logger, set_handler
from ou_logger import *
Importing the logger will display an information message:
Logger enabled. Set level as: logger.setLevel(LEVEL), where LEVEL is one of: DEBUG, INFO, WARNING, ERROR (default), CRITICAL.
Set text and/or text-to-speech output: set_handler('text, tts')
Usage: e.g. logger.error('This is an error message')
Logging messages will be displayed at or above the declared logging level. For example:
logger(CRITICAL)
will only displayCRITICAL
messages;logger(WARNING)
will displayWARNING
,ERROR
andCRITICAL
messages.
By default, messages will be displayed as text:
Logged messages can also be spoken aloud using the browser text-to-speech (TTS) engine.
Enable text and/or TTS output by setting:
set_handler("text")
set_handler("text, tts")
set_handler("tts")
When creating log messages, users often want to be able to hear values of things; using f-strings can help here. For example:
a = 1
logger.error(f"Value of a is: {a}")
It might be interesting looking for things that serialise objects to speech in a tidy way (see this issue for examples).
Build as: python -m build .
Push to PyPi as: twine upload dist/ou_logger*0.0.2*