Changelog
All notable changes to tiered-debug will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.4.0] - 2025-10-07
Changes
A bit of a reversion from 1.3.1 with regards to default logger kwargs, but with a better approach.
Updated version to 1.4.0 for release.
Configure
log,lv1,lv2,lv3,lv4, andlv5methods in_base.pyto use defaultNonevalue forexc_info,stack_info,stacklevel, andextra. IfNoneis provided, the logging module will apply its own defaults (exc_info=False,stack_info=False,extra={}, and then setstacklevelto the effective stack level).Pruned unused import in
docs/conf.py.Updated
debug.pyto useLiteral[1, 2, 3, 4, 5]forbeginandendparameters inbegin_enddecorator in order to match the typing in_base.py. This cleans up MyPy and other linter warnings.Updated
test_base.pyteststest_log_with_default_stacklevelandtest_log_levelsto collect the logger name from the fixture rather than hardcoding an expected value.
All tests passing. Tested pre-release in a sample project and everything looks good.
[1.3.1] - 2025-10-03
Changes
Updated version to 1.3.1 for patch release.
Updated
log,lv1,lv2,lv3,lv4, andlv5methods in_base.pyto use proper default values forexc_info(False),stack_info(False), andstacklevel(1) instead ofNone.Corrected tests
test_log_with_default_stacklevelandtest_log_levelsto verify that the record logger name matches the logger name assigned in the fixture, rather than a hardcoded expected value.Corrected
test_add_handlerandtest_log_with_default_stacklevelintest_base.pyto addcaplog.set_level(logging.DEBUG)for proper DEBUG log capture. Kudos to @schoekek for identifying the issue and supplying the fix in #6. The nice thing is that it’s not a code change, but an update to how testing is done.Discovered that ReadTheDocs builds were failing due to conditional resulting in
html_themebeing set toNonewhen building on ReadTheDocs. Updateddocs/conf.pyto always sethtml_themetosphinx_rtd_theme, at least for now.
All tests passing.
[1.3.0] - 2025-04-21
Added
Added
exc_info,stack_info, andextrakeyword arguments tolog,lv1,lv2,lv3,lv4, andlv5methods inTieredDebug, following Pythonloggingmodule specifications.logmethod now ensuresextrais an empty dictionary ifNoneis provided.Standardized all docstrings in
_base.pyto Google-style format with line length limits (code and docstrings: soft 80, hard 88; Args/Returns/Raises definitions: soft 72, hard 80; Examples: soft 68, hard 76).Added doctests to
_base.pyfor key methods to demonstrate usage and validate behavior.Standardized all docstrings in
debug.pyto Google-style format with line length limits (code and docstrings: soft 80, hard 88; Args/Returns/Raises definitions: soft 72, hard 80; Examples: soft 68, hard 76).Added doctests to
debug.pywith line length limits (soft 68, hard 76) for decorator and global instance.Standardized module docstring in
__init__.pyto Google-style format with doctests and line length limits (code and docstrings: soft 80, hard 88; Args/Returns/Raises definitions: soft 72, hard 80; Examples: soft 68, hard 76).Updated
docs/conf.pyfor tiered-debug with Google-style docstring, doctests, direct metadata imports enabled by module installation, and line length limits (code and docstrings: soft 80, hard 88; Args/Returns/Raises definitions: soft 72, hard 80; Examples: soft 68, hard 76).Updated
.readthedocs.yamlto configure ReadTheDocs build with module installation, Sphinx configuration, and dependency installation viadocs/requirements.txt.Added
docs/requirements.txtwith Sphinx dependencies for ReadTheDocs documentation builds.Enhanced tests in
test_base.pyto coverexc_info,stack_info, andextraparameters inTieredDebuglogging methods, including edge cases and performance.Added
__version__,__author__, and__copyright__to__all__in__init__.pyto export metadata.Added
W0622to pylint disable indocs/conf.pyto suppress redefined built-in warnings forcopyright.Fixed
test_log_with_extraandtest_log_all_parameters_combinedintest_base.pyto check log record attributes forextrametadata due topytest.inilog format.Fixed
test_log_with_stack_infoandtest_log_all_parameters_combinedintest_base.pyto check for correct stack trace prefix across Python 3.8-3.13.Updated
test_log_with_invalid_extra_typeintest_base.pyto expect TypeError for invalidextratypes, aligning with_base.pyvalidation.Renamed
stklvltostackleveland reordered keyword arguments (exc_info,stack_info,stacklevel,extra) in_base.pymethods to matchlogging.Logger.debug.Updated
debug.pyto usestackleveland enhancedbegin_enddecorator to acceptstacklevelandextra, defaulting to updating onlystacklevel.Updated
test_base.pyto usestacklevel, reordered keyword arguments, and added tests for*argsmessage formatting support in_base.pymethods.Fixed
test_select_frame_getter_non_cpythonintest_base.pyto correctly callinspect.currentframe()without arguments.Updated
debug.pyto restorebeginandendarguments forbegin_enddecorator, retainingstacklevelandextra.Updated
test_debug.pyto testbegin,end,stacklevel, andextrainbegin_enddecorator, restoring original test structure.Corrected
test_debug.pyto ensure all tests pass, as updated by user.Updated
index.rstto highlightstacklevelandextraand clarifydebug.py’s role.Updated
usage.rstto includestacklevel,extra,*args, correctset_level, align log output withpytest.ini, and enhance Elasticsearch handler example.Updated
usage.rstformatters to includeextrafields (%(context)s,%(module)s) in log output forTieredDebug,debug.py, Elasticsearch, and pytest examples.Re-rendered
usage.rstPython code blocks to fit within a 90-character hard limit to avoid side-scrolling.Corrected spacing in
usage.rstbash code block to improve visibility in rendered documentation, as updated by user.
[1.2.1] - 2025-04-17
Added
Unit tests for
debug.pyintest_debug.py.
Changed
Fixed unit tests in
test_base.pywhere setting the log level for caplog was required.
[1.2.0] - 2025-04-17
Added
Instance-level logger (
self._logger) inTieredDebugfor flexible configuration.add_handlermethod to attach handlers atlogging.DEBUGlevel, with info message for duplicates.Cached
_select_frame_getterto usesys._getframein CPython andinspect.currentframeelsewhere.Sphinx autodoc docstrings for all classes and methods.
Support for custom logger names via
logger_nameparameter inTieredDebug.__init__.
Changed
Removed environment variable support (
TIERED_DEBUG_LEVEL,TIERED_STACK_LEVEL).Updated
check_valto handleTypeErrorandValueErrorwith specific error logging.Improved error handling and validation throughout
TieredDebug.
[1.1.0] - 2025-04-15
Added
Initial
TieredDebugclass with tiered logging levels (1-5).begin_enddecorator indebug.pyfor logging function call boundaries.Environment variable support for setting debug and stack levels.
Basic unit tests in
test_base.py.
[1.0.0] - 2025-03-31
Added
Initial release of
tiered_debugmodule.TieredDebugclass with module-level logger.Support for debug levels 1-5 and stack levels 1-9.
debug.pysample module with globaldebuginstance.