{"id":8059,"library":"daiquiri","title":"Daiquiri (Logging Library)","description":"Daiquiri is a Python library designed to simplify the configuration of Python's built-in `logging` module. It provides an easy-to-use interface for setting up basic logging functionalities, including custom formatters and handlers, often with a single call to `daiquiri.setup()`. The library is actively maintained, with its current version being 3.4.0, and has a consistent update cadence.","status":"active","version":"3.4.0","language":"python","source_language":"en","source_url":"https://github.com/Mergifyio/daiquiri","tags":["logging","logger","configuration","structured logging"],"install":[{"cmd":"pip install daiquiri","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for using the JSON log formatter (daiquiri.formatter.JSON_FORMATTER).","package":"python-json-logger","optional":true}],"imports":[{"wrong":"import daiquiri; daiquiri.setup(...)","symbol":"setup","correct":"from daiquiri import setup"},{"symbol":"getLogger","correct":"from daiquiri import getLogger"},{"symbol":"parse_and_set_default_log_levels","correct":"from daiquiri import parse_and_set_default_log_levels"}],"quickstart":{"code":"import logging\nimport daiquiri\n\n# Basic setup to log to stderr with colors\ndaiquiri.setup(level=logging.INFO)\n\n# Get a logger instance\nlogger = daiquiri.getLogger(__name__)\n\nlogger.info('This is an info message.')\nlogger.warning('This is a warning message.')\nlogger.error('This is an error message with extra context!', user_id='123', transaction_id='abc')\n\n# Example with JSON output to a file (requires 'pip install python-json-logger')\n# from daiquiri.output import File\n# from daiquiri.formatter import JSON_FORMATTER\n# daiquiri.setup(\n#     level=logging.INFO,\n#     outputs=(\n#         File('app.log', formatter=JSON_FORMATTER),\n#     )\n# )\n# logger_json = daiquiri.getLogger('json_example')\n# logger_json.info('JSON message', data={'key': 'value'})","lang":"python","description":"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."},"warnings":[{"fix":"To disable this, pass `capture_warnings=False` to `daiquiri.setup()`: `daiquiri.setup(capture_warnings=False)`.","message":"Daiquiri 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.","severity":"gotcha","affected_versions":"All versions 2.x and 3.x"},{"fix":"Always retrieve loggers using `logger = daiquiri.getLogger(__name__)` to leverage all of Daiquiri's features.","message":"While 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.","severity":"gotcha","affected_versions":"All versions 2.x and 3.x"},{"fix":"Ensure `pip install python-json-logger` is run if you intend to use JSON formatting.","message":"For structured JSON logging using `daiquiri.formatter.JSON_FORMATTER`, the `python-json-logger` library is a required dependency and must be installed separately.","severity":"gotcha","affected_versions":"All versions 2.x and 3.x"}],"env_vars":null,"search_vec":"'3.4.0':58 'activ':51 'basic':33 'built':18 'built-in':17 'cadenc':64 'call':45 'configur':13,67 'consist':62 'current':55 'custom':37 'daiquiri':1,4 'daiquiri.setup':47 'design':9 'easi':26 'easy-to-us':25 'formatt':38 'function':35 'handler':40 'includ':36 'interfac':29 'librari':3,8,49 'log':2,20,34,65,69 'logger':66 'maintain':52 'modul':21 'often':41 'provid':23 'python':7,15 'set':31 'simplifi':11 'singl':44 'structur':68 'updat':63 'use':28 'version':56","created_at":"2026-04-16T17:00:13.987045+00:00","updated_at":"2026-04-16T17:00:13.987045+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.4.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Mergifyio/daiquiri","docs":null,"changelog":null,"pypi":"https://pypi.org/project/daiquiri/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}