{"id":15945619,"url":"https://github.com/klieret/python-colorlog","last_synced_at":"2025-04-03T22:14:28.824Z","repository":{"id":98217484,"uuid":"71716091","full_name":"klieret/python-colorlog","owner":"klieret","description":"For use together with the python3 logging module: Allows to automatically color logging messages based on their level.","archived":false,"fork":false,"pushed_at":"2017-04-03T18:48:39.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T10:11:48.665Z","etag":null,"topics":["color","colorization","colors","python3","python3-logging"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klieret.png","metadata":{"files":{"readme":"readme.rst","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-23T16:48:04.000Z","updated_at":"2022-01-09T14:41:17.000Z","dependencies_parsed_at":"2023-06-25T22:41:40.256Z","dependency_job_id":null,"html_url":"https://github.com/klieret/python-colorlog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2Fpython-colorlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2Fpython-colorlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2Fpython-colorlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2Fpython-colorlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klieret","download_url":"https://codeload.github.com/klieret/python-colorlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247086024,"owners_count":20881160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color","colorization","colors","python3","python3-logging"],"created_at":"2024-10-07T09:04:37.300Z","updated_at":"2025-04-03T22:14:28.801Z","avatar_url":"https://github.com/klieret.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Color for the python3 logging module\n====================================\n**JUST FOUND OUT THAT THERE's AN OLDER PACKAGE, WHICH IS ALSO BETTER**: Check out `colorlog  \u003chttps://github.com/borntyping/python-colorlog\u003e`_ from bornyping.\n\n|Build Status|\n\nFor use together with the python3 logging module: Allows to\nautomatically color logging messages based on their level.\n\n.. figure:: https://cloud.githubusercontent.com/assets/13602468/24600851/cf941cdc-1856-11e7-97da-b8cd18568577.png \n   :alt: screenshot\n\n   screenshot\n\nInstallation\n------------\n\nAs this project is still in development, you have to clone the\nrepository first and then install it with ``pip``:\n\n.. code:: sh\n\n    git clone https://github.com/klieret/python-colorlog\n    cd python-colorlog\n    pip3 install .\n\nUsage\n-----\n\nMinimal example, using one of the predefined color schemes from\n``demo_profiles.py``:\n\n.. code:: python\n\n    import logging\n    from colored_logging import ColoredStreamHandler\n\n    # Some demo color profile\n    from demo_profiles import demo_lcolor_profiles\n\n    logger = logging.getLogger(\"logger\")\n    logger.setLevel(logging.DEBUG)\n\n    sh = ColoredStreamHandler(demo_lcolor_profiles['default'])\n    logger.addHandler(sh)\n\n    logger.error(\"Some error message.\")\n\nColor profiles are ``int:str`` dictionaries that map level numbers to\nformatting strings. To do this platform independent, it is recommended\nto use some module like ``colorama``:\n\n.. code:: python\n\n    import logging\n    from colored_logging import ColoredStreamHandler\n\n    import colorama\n    from colorama import Fore, Back, Style\n    colorama.init()\n\n    my_profile = {\n        logging.CRITICAL: Fore.RED + Style.BRIGHT,\n        logging.ERROR:    Fore.RED + Style.BRIGHT,\n        logging.WARNING:  Fore.MAGENTA + Style.BRIGHT,\n        logging.INFO:     Fore.GREEN + Style.BRIGHT,\n        logging.DEBUG:    Fore.GREEN,\n        -1:               Style.RESET_ALL\n    }\n\n    sh = ColoredStreamHandler(my_profile)\n\n    (...)\n\n**Note: Always define a reset sequence (to the key -1) that resets the\ncolor/formatting to the default value**\n\nLicense\n-------\n\nThe contents of this repository are licensed under the *GNU Lesser\nGeneral Public License v3.0*.\n\n.. |Build Status| image:: https://travis-ci.org/klieret/python-colorlog.svg?branch=master\n   :target: https://travis-ci.org/klieret/python-colorlog\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklieret%2Fpython-colorlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklieret%2Fpython-colorlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklieret%2Fpython-colorlog/lists"}