diff -Nru python-colorlog-4.6.2/colorlog/escape_codes.py python-colorlog-4.7.2/colorlog/escape_codes.py --- python-colorlog-4.6.2/colorlog/escape_codes.py 2020-11-09 10:17:32.000000000 +0000 +++ python-colorlog-4.7.2/colorlog/escape_codes.py 2021-01-14 12:46:28.000000000 +0000 @@ -5,13 +5,15 @@ Uses colorama as an optional dependency to support color on Windows """ +import sys try: import colorama except ImportError: pass else: - colorama.init(strip=False) + if sys.platform == "win32": + colorama.init(strip=False) __all__ = ('escape_codes', 'parse_colors') diff -Nru python-colorlog-4.6.2/debian/changelog python-colorlog-4.7.2/debian/changelog --- python-colorlog-4.6.2/debian/changelog 2020-12-28 14:52:21.000000000 +0000 +++ python-colorlog-4.7.2/debian/changelog 2021-01-23 09:56:30.000000000 +0000 @@ -1,3 +1,9 @@ +python-colorlog (4.7.2-1) unstable; urgency=medium + + * New upstream version 4.7.2 + + -- Philipp Huebner Sat, 23 Jan 2021 10:56:30 +0100 + python-colorlog (4.6.2-1) unstable; urgency=medium [ Debian Janitor ] diff -Nru python-colorlog-4.6.2/doc/yaml_example.py python-colorlog-4.7.2/doc/yaml_example.py --- python-colorlog-4.6.2/doc/yaml_example.py 1970-01-01 00:00:00.000000000 +0000 +++ python-colorlog-4.7.2/doc/yaml_example.py 2021-01-14 12:46:28.000000000 +0000 @@ -0,0 +1,53 @@ +""" +Based on an example provided by Ricardo Reis. +https://github.com/ricardo-reis-1970/colorlog-YAML + +This configures the `logging` module from a YAML file, and provides specific +configuration for the loggers named 'application' and 'example'. +""" + +import logging.config +import pathlib + +import yaml + + +def config(): + """ + Configure `logging` from a YAML file. You might adjust this function to + provide the configuration path as an argument. + """ + path = pathlib.Path(__file__).with_suffix('.yaml') + logging.config.dictConfig(yaml.safe_load(path.read_text())) + + +if __name__ == '__main__': + config() + + root = logging.getLogger() + root.debug("Root logs debug example") + root.info("Root logs written to console without colours") + root.warning("Root logs warning") + root.error("Root logs error") + root.critical("Root logs critical") + + unknown = logging.getLogger('unknown') + unknown.debug("Unknown logs debug example") + unknown.info("Unknown logs propagated to root logger") + unknown.warning("Unknown logs warning") + unknown.error("Unknown logs error") + unknown.critical("Unknown logs critical") + + application = logging.getLogger('application') + application.debug("Application logs debug filtered by log level") + application.info("Application logs written to console and file") + application.warning("Application logs not propagated to the root logger") + application.error("Application logs error example") + application.critical("Application logs critical example") + + example = logging.getLogger('example') + example.debug("Example logs debug filtered by log level") + example.info("Example logs configured to write to file") + example.warning("Example logs propagated to the root logger") + example.error("Example logs error example") + example.critical("Example logs critical example") diff -Nru python-colorlog-4.6.2/doc/yaml_example.yaml python-colorlog-4.7.2/doc/yaml_example.yaml --- python-colorlog-4.6.2/doc/yaml_example.yaml 1970-01-01 00:00:00.000000000 +0000 +++ python-colorlog-4.7.2/doc/yaml_example.yaml 2021-01-14 12:46:28.000000000 +0000 @@ -0,0 +1,34 @@ +version: 1 +formatters: + logging: + format: '%(asctime)s - %(name)-11s - %(levelname)-8s - %(message)-60s - formatter=logging.Formatter' + colorlog: + (): 'colorlog.ColoredFormatter' + format: '%(log_color)s%(asctime)s - %(name)-11s - %(levelname)-8s - %(message)-60s - formatter=colorlog.ColoredFormatter' +handlers: + console: + class: logging.StreamHandler + level: DEBUG + formatter: logging + stream: ext://sys.stdout + file: + class: logging.FileHandler + level: WARNING + formatter: logging + filename: doc/example_yaml.log + colour: + class: logging.StreamHandler + level: DEBUG + formatter: colorlog +loggers: + '': + level: DEBUG + handlers: [console] + example: + level: INFO + handlers: [file] + propagate: yes + application: + level: INFO + handlers: [colour, file] + propagate: no diff -Nru python-colorlog-4.6.2/MANIFEST.in python-colorlog-4.7.2/MANIFEST.in --- python-colorlog-4.6.2/MANIFEST.in 2020-11-09 10:17:32.000000000 +0000 +++ python-colorlog-4.7.2/MANIFEST.in 2021-01-14 12:46:28.000000000 +0000 @@ -1,5 +1,5 @@ global-exclude *.py[co] -include colorlog/tests/ -include doc/ +recursive-include colorlog/tests/ *.py *.ini +recursive-include doc/ *.py *.png include LICENSE include README.md diff -Nru python-colorlog-4.6.2/README.md python-colorlog-4.7.2/README.md --- python-colorlog-4.6.2/README.md 2020-11-09 10:17:32.000000000 +0000 +++ python-colorlog-4.7.2/README.md 2021-01-14 12:46:28.000000000 +0000 @@ -1,15 +1,15 @@ Log formatting with colors! =========================== -[![](https://img.shields.io/pypi/v/colorlog.svg)](https://warehouse.python.org/project/colorlog/) -[![](https://img.shields.io/pypi/l/colorlog.svg)](https://warehouse.python.org/project/colorlog/) +[![](https://img.shields.io/pypi/v/colorlog.svg)](https://pypi.org/project/colorlog/) +[![](https://img.shields.io/pypi/l/colorlog.svg)](https://pypi.org/project/colorlog/) [![](https://img.shields.io/travis/borntyping/python-colorlog/master.svg)](https://travis-ci.org/borntyping/python-colorlog) `colorlog.ColoredFormatter` is a formatter for use with Python's `logging` module that outputs records using terminal colors. * [Source on GitHub](https://github.com/borntyping/python-colorlog) -* [Packages on PyPI](https://pypi.python.org/pypi/colorlog) +* [Packages on PyPI](https://pypi.org/pypi/colorlog/) * [Builds on Travis CI](https://travis-ci.org/borntyping/python-colorlog) Installation @@ -197,6 +197,15 @@ codebase to add features to. Any changes that might break backwards compatibility for existing users will not be considered. +Alternatives +------------ + +There are some more modern libraries for improving Python logging you may +find useful. + +- [structlog] +- [jsonlog] + Projects using colorlog ----------------------- @@ -229,7 +238,7 @@ [dictConfig]: http://docs.python.org/3/library/logging.config.html#logging.config.dictConfig [fileConfig]: http://docs.python.org/3/library/logging.config.html#logging.config.fileConfig -[addLevelName]: https://docs.python.org/3/library/logging.html#logging.addLevelNam[addLevelN]e +[addLevelName]: https://docs.python.org/3/library/logging.html#logging.addLevelName [Formatter]: http://docs.python.org/3/library/logging.html#logging.Formatter [tox]: http://tox.readthedocs.org/ [Arch AUR]: https://aur.archlinux.org/packages/python-colorlog/ @@ -242,6 +251,8 @@ [Fedora packaging scripts]: https://github.com/bartv/python-colorlog [Gentoo]: https://packages.gentoo.org/packages/dev-python/colorlog [OpenSuse]: http://rpm.pbone.net/index.php3?stat=3&search=python-colorlog&srodzaj=3 -[Pythran]: http://pythonhosted.org/pythran/DEVGUIDE.html +[Pythran]: https://github.com/serge-sans-paille/pythran [Ubuntu]: https://launchpad.net/python-colorlog [zenlog]: https://github.com/ManufacturaInd/python-zenlog +[structlog]: https://www.structlog.org/en/stable/ +[jsonlog]: https://github.com/borntyping/jsonlog diff -Nru python-colorlog-4.6.2/setup.py python-colorlog-4.7.2/setup.py --- python-colorlog-4.6.2/setup.py 2020-11-09 10:17:32.000000000 +0000 +++ python-colorlog-4.7.2/setup.py 2021-01-14 12:46:28.000000000 +0000 @@ -2,7 +2,7 @@ setup( name='colorlog', - version='4.6.2', + version='4.7.2', description='Log formatting with colors!', long_description=open('README.md').read(),