Changelog

The purpose of this document is to list all of the notable changes to this project. The format was inspired by Keep a Changelog. This project adheres to semantic versioning.

Release 14.0 (2020-02-16)

Integrate native Windows 10 support for ANSI escape sequences (#71, #72).

Native support for ANSI escape sequences was added to Windows 10 after its initial release, specifically in release 10.0.14393. I’ve now updated coloredlogs and humanfriendly to detect and enable this “new” native support.

Windows 10 seems to comprise the majority of Windows installations worldwide so in the interest of “looking forward” I’ve decided to drop the colorama requirement, given that it has now become a minority use case.

Hopefully most existing users will not experience any regression because they previously installed colorama already, and when available it will still be used. However new installations on older Windows systems now require users to install colorama separately. This has been documented in the readme in an attempt to minimize resulting confusion.

PS. In case anyone is wondering: I decided that giving a major Windows support update in coloredlogs the version 13.0 was asking for trouble, so I decided not to do that 😇.

Release 12.0 (2020-02-16)

Two backwards incompatible changes prompted another major version bump:

  • Merged pull request #80 that drops support for Python 3.4 which has gone end-of-life and now represents less than 1% of PyPI downloads.
  • Improved compatibility with the Python standard library by changing the order of positional arguments received by the initializer of the ColoredFormatter class (as suggested in #64 and #75).

Release 11.3 (2020-02-15)

  • Add support for the %(username)s field (requested in #76) and properly document supported custom fields.
  • Consistently use console highlighting in documentation.
  • Fix a broken link in the readme.

Release 11.2 (2020-02-15)

Merge pull request #79 which adds support for Python 3.8.

Release 11.1 (2020-02-15)

Starting with the previous release I’ve resolved to try and tackle the large number of open issues after an unplanned hiatus from the development and maintenance of my open source projects, so here are some more bug fixes:

  • Fix support for custom log record factories and add a test to avoid regressions (#47, #59).
  • Change make screenshots to be Python 3 compatible and document additional requirements (#65).

Release 11.0 (2020-02-14)

This is a maintenance release that drops Python 2.6 support, adds Python 3.7 support and merges quite a few minor pull requests. The major version number was bumped because of the compatibility changes.

Merged pull requests:

  • #58: Don’t import coloredlogs if $COLOREDLOGS_AUTO_INSTALL is set but empty.
  • #60: Fix flake8 messages to help stabilize Travis CI builds.
  • #61: Drop support for Python 2.6 to help stabilize Travis CI builds.
  • #62: Use SVG badge in README for consistency.
  • #69: Handle negative-offset timezones in tests.
  • #70: Use subprocess.check_call() in the test suite to ensure that external commands succeed.
  • #74: Fix TypeError on MacOS on Python 3 in the converter module.

Other changes:

  • Start testing on Python 3.7 (and document compatibility).
  • Workaround Python 3.7 regression in test suite.
  • Update Makefile to use Python 3 for local development.
  • Merge MacOS on Travis CI fixes from humanfriendly.

Release 10.0 (2018-05-13)

Proper format string parsing, support for style='{' (#11, #17, #52).

Until now coloredlogs has required differently colored fields in logging format strings to be delimited by whitespace, leading to various issues:

  • Back in December 2015 issue #11 was reported by someone who had expected to be able to style fields without whitespace in between differently.
  • Until #52 was merged (released as 9.2 in April 2018) any whitespace would be collapsed to a single space, simply as a side effect of splitting on whitespace.
  • This implementation was so naive that it didn’t support whitespace as a padding character in %() formatting directives, because it wasn’t able to distinguish formatting directives from surrounding text.

In order to properly fix #11 I’m now introducing a very different approach that does distinguish formatting directives from their surrounding text, which means whitespace is no longer required. However in order to reduce the conceptual incompatibilities between the old versus new approach whitespace is still significant, as follows:

  1. First the logging format string is separated into formatting directives versus surrounding text (which means whitespace used as a padding character in a %() formatting directive is considered to be part of the formatting directive, as it should).
  2. Then formatting directives and surrounding text are grouped based on whitespace delimiters (in the surrounding text).
  3. For each group styling is selected as follows:
    1. If the group contains a single formatting directive that has a style defined then the whole group is styled accordingly. This is the behavior which provides (some level of) conceptual backwards compatibility.
    2. If the group contains multiple formatting directives that have styles defined then each formatting directive is styled individually and surrounding text isn’t styled (this behavior is backwards incompatible but arguably an improvement over the old behavior).

While I was working on the improved format string parsing I figured it was easiest to include support for style='{' (requested in #17) from the start in the new implementation, given that I was redoing the affected code anyway.

Release 9.3.1 (2018-04-30)

Bug fix: Restore MacOS compatibility after publishing release 9.3.

The following build failure became apparent to me just minutes after publishing release 9.3 so I decided to change the implementation: https://travis-ci.org/xolox/python-coloredlogs/jobs/372806733

Release 9.3 (2018-04-29)

Enable flexible millisecond formatting using the %f directive (#45).

Release 9.2 (2018-04-27)

  • Merged pull request #47: Switch to logging.getLogRecordFactory(). In the merge commit I added a small performance enhancement by checking for the existence of logging.getLogRecordFactory() just once, when a ColoredFormatter object is instantiated.
  • Merged pull request #52: Don’t change whitespace in format strings. In the merge commit I promoted the inline function to an instance method so that it can be reused by sub classes of ColoredFormatter.

Release 9.1 (2018-04-26)

  • Added license key to setup.py script (#53).
  • Added this changelog (requested in #55).

Release 9.0 (2018-01-17)

Added support for background colors and 256 color mode (#35).

Most of the changes required for this were actually implemented in the humanfriendly package (see issue #35). The changes in coloredlogs are mostly related to the ANSI to HTML conversion.

One unrelated change was made, that was to use faint green for the SPAM log level (to distinguish it from DEBUG).

New features in ANSI to HTML conversion:

  • Support for bright and faint colors.
  • Support for underlined, strike-through and inverse text styles.

Bug fixes in ANSI to HTML conversion:

  • The scheme of URLs is no longer stripped from visible output.
  • Support for \x1b[m as a short hand for \x1b[0m (I only learned about this today when I didn’t understand the empty ANSI escape sequence at the end of each line emitted by hg log).
  • Ensure that the pattern for URLs doesn’t capture ANSI sequences.
  • Documenting how it all works. This will follow in the next commit which is going to be a rather big one (hence why I see some value in keeping it separate from the implementation changes).

Miscellaneous changes:

  • Add installation instructions to readme.
  • Improve screenshots in documentation.
  • Automate taking of screen shots :-).

Release 8.0 (2018-01-05)

Set the default date format in a new formatTime() method (#42).

I decided to bump the major version number because this change is technically backwards incompatible, even though it concerns a minor detail (datefmt being set to its default value in the initializer). Then again, this change does improve compatibility with the behavior of the logging.Formatter class in Python’s standard library, so there’s that :-).

Release 7.3.3 (2018-01-05)

Bug fix for coloredlogs --demo so that it always displays the DEBUG message (#41).

Release 7.3.2 (2018-01-05)

Bug fixes and improvements to ANSI to HTML conversion:

  • Make sure that conversion of empty input produces no output.
  • Strip bogus ^D from output captured on MacOS.
  • Increase test coverage on MacOS via Travis CI.

Release 7.3.1 (2017-11-23)

Bug fix for get_install_requires() in setup.py script (fixes #43).

Release 7.3 (2017-08-07)

Added support for the SUCCESS log level (related to #27 and verboselogs issue #4).

Release 7.2 (2017-08-07)

Merged pull requests #34, #37 and #38:

  • Include the files needed to generate the Sphinx documentation in source distributions published to PyPI (#34).
  • Improve documentation by removing usage of deprecated logger.warn() function (#37).
  • Improve documentation by using module __name__ variable for logger name (#38).
  • Also fixed the test suite after verboselogs 1.7 was released.

Release 7.1 (2017-07-15)

Make it easy to output milliseconds and improve documentation on this (#16).

Release 7.0.1 (2017-07-15)

Try to improve robustness during garbage collection (related to #33).

Release 7.0 (2017-05-18)

This release improves the robustness of ANSI to HTML conversion:

  • Don’t break ANSI to HTML conversion on output encoding errors.
  • Gracefully handle unsupported colors in converter module.
  • Make it even easier to integrate with cron.
  • Improved the HTML encoding of whitespace.
  • Wrap generated HTML in <code> by default.
  • Reduced the size of generated HTML (really CSS).
  • Reduced internal duplication of constants.

Release 6.4 (2017-05-17)

Mention colorama.init() in the documentation (fixes #25).

Release 6.3 (2017-05-17)

Bug fix: Avoid copy.copy() deadlocks (fixes #29).

This was a rather obscure issue and I expect this not to to affect most users, but the reported breakage was definitely not intended, so it was a bug I wanted to fix.

Release 6.2 (2017-05-17)

Enable runtime patching of sys.stderr (related to #30 and #31).

Release 6.1 (2017-04-17)

  • Bug fix: Adjust logger level in set_level(), increase_verbosity(), etc. (this is a follow up to release 6.0).
  • Bug fix: Never enable system logging on Windows.
  • Increase test coverage (using mocking).
  • Document Python 3.6 support.

Release 6.0 (2017-03-10)

Two backwards incompatible changes were made:

  • Changed log level handling in coloredlogs.install().
  • Changed the default system logging level from DEBUG to INFO. To make it easier to restore the old behavior, coloredlogs.install(syslog='debug') is now supported.

The old and problematic behavior was as follows:

  • coloredlogs.install() would unconditionally change the log level of the root logger to logging.NOTSET (changing it from the root logger’s default level logging.WARNING) and the log levels of handler(s) would control which log messages were actually emitted.
  • enable_system_logging() would never change the root logger’s log level, which meant that when enable_system_logging() was used in isolation from install() the default log level would implicitly be set to logging.WARNING (the default log level of the root logger).

Over the years I’ve gotten a lot of feedback about the log level handling in the coloredlogs package, it was clearly the number one cause of confusion for users. Here are some examples:

My hope is that with the changes I’ve made in the past days, the experience for new users will be more ‘Do What I Mean’ and less ‘What The Fuck is Going On Here?!’ :-). Of course only time (and feedback, or lack thereof) will tell whether I’ve succeeded.

Release 5.2 (2016-11-01)

Merged pull request #19: Automatically call coloredlogs.install() if COLOREDLOGS_AUTO_INSTALL=true.

While merging this pull request and writing tests for it I changed the implementation quite a bit from the original pull request:

  • The environment variable was renamed from COLOREDLOGS_AUTOUSE to COLOREDLOGS_AUTO_INSTALL (in order to make it consistent with the other environment variables) and added to the documentation.
  • The coloredlogs.pth file was changed in order to reduce the amount of code required inside the *.pth file as much as possible and create room to grow this feature if required, by extending auto_install(). I seriously dislike writing out complex code in a single line, especially when dealing with Python code :-).
  • The coloredlogs.pth file has been added to MANIFEST.in to make sure that python setup.py sdist copies the *.pth file into the source distribution archives published to PyPI.
  • The setup.py script was changed to figure out the location of the lib/pythonX.Y/site-packages directory using distutils instead of ‘hard coding’ the site-packages name (which I dislike for various reasons).
  • The setup.py script was changed to preserve compatibility with universal wheel distributions using what looks like an undocumented hack found through trial and error (the other hacks I found were much worse :-). I ran into this incompatibility when running the tests under tox, which runs pip install under the hood, which in turn runs python setup.py bdist_wheel under the hood to enable wheel caching.

Release 5.1.1 (2016-10-10)

  • Starting from this release wheel distributions are published to PyPI.
  • Refactored makefile and setup script (checkers, docs, wheels, twine, etc).
  • Replaced coloredlogs.readthedocs.org with coloredlogs.readthedocs.io everywhere.

Release 5.1 (2016-10-09)

  • Bug fix: Enable command capturing on MacOS (fixes #12).
  • Add styles for the SPAM and NOTICE levels added by my verboselogs package.
  • Set up automated MacOS tests on Travis CI.
  • Documented Python 3.5 support.

Release 5.0 (2015-11-14)

  • Remove ColoredStreamHandler and related functionality, thereby breaking backwards compatibility.
  • Remove Vim syntax script (impossible given user defined log formats :-).
  • Improve test coverage.

Release 4.0 (2015-11-14)

Enable reconfiguration (also: get rid of global root handler).

Release 3.5 (2015-11-13)

  • Bug fix: Never install duplicate syslog handlers.
  • Added walk_propagation_tree() function (not useful in isolation :-).
  • Added find_handler() function (still not very useful in isolation).

Release 3.4 (2015-11-13)

Make it very easy to enable system logging.

Release 3.3 (2015-11-13)

Easy to use UNIX system logging?! I know this is unrelated to the name of this project - refer to the added documentation for more on that :-).

Release 3.2 (2015-11-12)

  • Enable %(programname)s based on sys.argv[0].
  • Increase test coverage.

Release 3.1.4 (2015-10-31)

Bug fix: Don’t use bold font on Windows (follow up to previous change).

Release 3.1.3 (2015-10-27)

Bug fix: Don’t use bold font on Windows (not supported). For future reference, I found this issue here: https://ci.appveyor.com/project/xolox/pip-accel/build/1.0.15

Release 3.1.2 (2015-10-24)

Bug fix for log format colorization (fixes #9).

Rationale: I’m not validating the format, I just want to extract the referenced field names, so looking for %(..) without a trailing type specifier (and optional modifiers) is fine here.

Release 3.1.1 (2015-10-23)

Fixed broken Colorama reference in README.rst because it breaks the reStructuredText rendering on PyPI.

Release 3.1 (2015-10-23)

Depend on and use Colorama on Windows (as suggested in #2). I can’t actually test this because I don’t have access to a Windows system, but I guess some day someone will complain if this doesn’t work as intended ;-).

Release 3.0 (2015-10-23)

Major rewrite: Added ColoredFormatter, deprecated ColoredStreamHandler.

  • Fixed #2 by switching from connected_to_terminal() to terminal_supports_colors() (the latter understands enough about Windows to know it doesn’t support ANSI escape sequences).
  • Fixed #6 by adding support for user defined formats (even using a custom filter to enable the use of %(hostname)s :-).
  • Fixed #7 by adding support for user defined formats and making coloredlogs.install() an almost equivalent of logging.basicConfig().

This rewrite mostly resolves pip-accel issue #59. Basically all that’s missing is a configuration option in pip-accel to make it easier to customize the log format, although that can now be done by setting $COLOREDLOGS_LOG_FORMAT.

Release 2.0 (2015-10-14)

  • Backwards incompatible: Change ansi2html to coloredlogs --convert (see #8).
  • Implement and enforce PEP-8 and PEP-257 compliance.
  • Change Read the Docs links to use HTTPS.
  • Move ad-hoc coverage configuration from Makefile to .coveragerc.

Release 1.0.1 (2015-06-02)

  • Bug fix for obscure UnicodeDecodeError in setup.py (only on Python 3).
  • Document PyPy as a supported (tested) Python implementation.

Release 1.0 (2015-05-27)

  • Move coloredlogs.ansi_text() to humanfriendly.ansi_wrap().
  • Update setup.py to add trove classifiers and stop importing __version__.
  • Start linking to Read the Docs as the project homepage.

Release 0.8 (2014-10-03)

  • Merged pull request #5 which makes the severity to color mapping configurable.
  • Added support for bold / faint / underline / inverse / strike through text styles. This extends the changes in pull request #5 into a generic severity ↔ color / style mapping and adds support for five text styles.
  • Added a coverage badge to the readme.

Release 0.7.1 (2014-10-02)

Bug fix: Restore Python 3.4 compatibility.

Release 0.7 (2014-10-02)

  • First stab at a proper test suite (already >= 90% coverage)
  • Prepare to publish documentation on Read the Docs.

Release 0.6 (2014-09-21)

Added decrease_verbosity() function (and simplify increase_verbosity()).

Release 0.5 (2014-05-10)

  • Merge pull request #4 adding Python 3 compatibility.
  • Start using Travis CI (so I don’t accidentally drop Python 3 compatibility).
  • Document supported Python versions (2.6, 2.7 & 3.4).
  • Move demo code to separate coloredlogs.demo module.

Release 0.4.9 (2014-05-03)

Make the ansi2html command a bit more user friendly.

Release 0.4.8 (2013-10-19)

Make it possible to use /etc/debian_chroot instead of socket.gethostname().

Release 0.4.7 (2013-09-29)

Added is_verbose() function (another easy shortcut :-).

Release 0.4.6 (2013-08-07)

Added increase_verbosity() function (just an easy shortcut).

Release 0.4.5 (2013-08-07)

ColoredStreamHandler now supports filtering on log level.

Release 0.4.4 (2013-08-07)

Bug fix: Protect against sys.stderr.isatty() not being defined.

Release 0.4.3 (2013-07-21)

Change: Show the logger name by default.

Release 0.4.2 (2013-07-21)

Added coloredlogs.install() function.

Release 0.4.1 (2013-07-20)

Bug fix for ansi2html: Don’t leave typescript files behind.

Release 0.4 (2013-07-20)

Added ansi2html program to convert colored text to HTML.

Release 0.3.1 (2013-07-01)

Bug fix: Support Unicode format strings (issue #3).

Release 0.3 (2013-06-06)

Merge pull request #1: Refactor timestamp and name formatting into their own methods so callers can override the format. I made the following significant changes during merging:

  • Added docstrings & mention subclassing in README.md
  • Don’t call os.getpid() when the result won’t be used.
  • Don’t call render_*() methods when results won’t be used.

Release 0.2 (2013-05-31)

  • Change text styles (seems like an improvement to me)
  • Integration with my just released verboselogs module.
  • Improve the readme (with screenshots).
  • Add PyPI link to coloredlogs.py.
  • Add URL to setup.py.
  • Vim syntax mode for colored logs!

Release 0.1 (2013-05-16)

Initial commit.