Install & Compatibility
Where this runs
tested against v3.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.128s · 18.1MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.119s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
setup
✓ from daiquiri import setup
✗ import daiquiri; daiquiri.setup(...)
getLogger
✓ from daiquiri import getLogger
parse_and_set_default_log_levels
✓ from daiquiri import parse_and_set_default_log_levels
This quickstart demonstrates how to initialize Daiquiri for basic logging to `stderr` with colored output. It also shows how to obtain a logger instance and log messages at different levels, including custom keyword arguments which Daiquiri supports natively. An commented-out example for JSON file logging is also provided, highlighting the need for an additional dependency.
import logging
import daiquiri
# Basic setup to log to stderr with colors
daiquiri.setup(level=logging.INFO)
# Get a logger instance
logger = daiquiri.getLogger(__name__)
logger.info('This is an info message.')
logger.warning('This is a warning message.')
logger.error('This is an error message with extra context!', user_id='123', transaction_id='abc')
# Example with JSON output to a file (requires 'pip install python-json-logger')
# from daiquiri.output import File
# from daiquiri.formatter import JSON_FORMATTER
# daiquiri.setup(
# level=logging.INFO,
# outputs=(
# File('app.log', formatter=JSON_FORMATTER),
# )
# )
# logger_json = daiquiri.getLogger('json_example')
# logger_json.info('JSON message', data={'key': 'value'})
Debug
Known issues
gotchaDaiquiri by default overrides Python's standard `warnings` module behavior, routing warnings to the `py.warnings` logger. If you rely on default `warnings` module behavior or custom warning filters, this might affect your application.fixTo disable this, pass `capture_warnings=False` to `daiquiri.setup()`: `daiquiri.setup(capture_warnings=False)`.
affects: All versions 2.x and 3.x
gotchaWhile standard `logging.getLogger()` works, `daiquiri.getLogger()` is recommended. It provides an enhanced logger object that allows passing arbitrary keyword arguments to logging methods, which are then included as part of the log record. This enables rich, structured logging without extra boilerplate.fixAlways retrieve loggers using `logger = daiquiri.getLogger(__name__)` to leverage all of Daiquiri's features.
affects: All versions 2.x and 3.x
gotchaFor structured JSON logging using `daiquiri.formatter.JSON_FORMATTER`, the `python-json-logger` library is a required dependency and must be installed separately.fixEnsure `pip install python-json-logger` is run if you intend to use JSON formatting.
affects: All versions 2.x and 3.x
Upgrade
Version history
3.4.0latest on PyPI · released Sep 4, 2025
Audit
Dependencies
python-json-loggeroptionalRequired for using the JSON log formatter (daiquiri.formatter.JSON_FORMATTER).