{"id":25895649,"url":"https://github.com/diamondlightsource/dls-logformatter","last_synced_at":"2025-07-22T14:35:36.339Z","repository":{"id":145695171,"uuid":"594956713","full_name":"DiamondLightSource/dls-logformatter","owner":"DiamondLightSource","description":"Python logging formatter for readability.  Implemented as an override for the logging.Formatter class.","archived":false,"fork":false,"pushed_at":"2023-04-03T08:05:25.000Z","size":6781,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-02T22:33:11.317Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DiamondLightSource.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":".github/CONTRIBUTING.rst","funding":null,"license":"LICENSE","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":"2023-01-30T04:41:59.000Z","updated_at":"2024-12-19T11:04:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc5657f7-8b8b-4492-b7df-dfb4d5957915","html_url":"https://github.com/DiamondLightSource/dls-logformatter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/DiamondLightSource/dls-logformatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiamondLightSource%2Fdls-logformatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiamondLightSource%2Fdls-logformatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiamondLightSource%2Fdls-logformatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiamondLightSource%2Fdls-logformatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiamondLightSource","download_url":"https://codeload.github.com/DiamondLightSource/dls-logformatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiamondLightSource%2Fdls-logformatter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266510704,"owners_count":23940702,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-03-02T22:32:19.478Z","updated_at":"2025-07-22T14:35:36.321Z","avatar_url":"https://github.com/DiamondLightSource.png","language":"Python","readme":"dls-logformatter\n=======================================================================\n\nPython logging formatter for readability.\n\nImplemented as an override for the logging.Formatter class.\n\nIntended advantages:\n\n- readable nested traceback exception cause chains\n- compose message for either user, developer or log server\n- reusable library for consistency across multiple projects\n\nInstallation\n-----------------------------------------------------------------------\n::\n\n    pip install git+https://gitlab.diamond.ac.uk/scisoft/dls-logformatter.git \n\n    dls-logformatter --version\n\nUsage\n-------------------------------------------------\n.. code-block:: python\n\n    import logging\n\n    from dls_logformatter.dls_logformatter import DlsLogformatter\n\n    # Make handler which writes the logs to console.\n    handler = logging.StreamHandler()\n\n    # Make the formatter from this library.\n    dls_logformatter = DlsLogformatter()\n\n    # Let handler write the custom formatted messages.\n    handler.setFormatter(dls_logformatter)\n\n    # Let root logger use the handler.\n    root_logger = logging.getLogger()\n    root_logger.addHandler(handler)\n\nExample output\n-----------------------------------------------------------------------\n``dls_logformatter --example long``\n\n::\n\n    2022-12-25 06:23:42.612463   195 MainProcess  MainThread          0        0 WARNING   /22/dls-logformatter/src/dls_logformatter/__main__.py[35] this is a warning message\n    2022-12-25 06:23:42.612568   195 MainProcess  MainThread          0        0 INFO      /22/dls-logformatter/src/dls_logformatter/__main__.py[36] this is an info message\n    2022-12-25 06:23:42.612609   195 MainProcess  MainThread          0        0 INFO      /22/dls-logformatter/src/dls_logformatter/__main__.py[37] this is a debug message\n    2022-12-25 06:23:42.612666   195 MainProcess  MainThread          0        0 ERROR     /22/dls-logformatter/src/dls_logformatter/__main__.py[42] this is an error message\n                                                                                 EXCEPTION RuntimeError: error in deep3\n                                                                                 TRACEBACK /22/dls-logformatter/src/dls_logformatter/__main__.py[40] deep1()\n                                                                                 TRACEBACK /22/dls-logformatter/src/dls_logformatter/__main__.py[18] deep2()\n                                                                                 TRACEBACK /22/dls-logformatter/src/dls_logformatter/__main__.py[14] deep3()\n                                                                                 TRACEBACK /22/dls-logformatter/src/dls_logformatter/__main__.py[10] raise RuntimeError(\"error in deep3\")\n\n``dls_logformatter --example short``\n\n::\n\n           0        0 WARNING   dls_logformatter.__main__::example[37] this is a warning message\n           0        0 INFO      dls_logformatter.__main__::example[38] this is an info message\n           0        0 INFO      dls_logformatter.__main__::example[39] this is a debug message\n           0        0 ERROR     dls_logformatter.__main__::example[44] this is an error message\n                      EXCEPTION RuntimeError: error in deep3\n                      TRACEBACK dls_logformatter.__main__::example[42] deep1()\n                      TRACEBACK dls_logformatter.__main__::deep1[18] deep2()\n                      TRACEBACK dls_logformatter.__main__::deep2[14] deep3()\n                      TRACEBACK dls_logformatter.__main__::deep3[10] raise RuntimeError(\"error in deep3\")\n\n``dls_logformatter --example bare``\n\n::\n\n    this is a warning message\n    this is an info message\n    this is a debug message\n    this is an error message\n    \n\nDocumentation\n-----------------------------------------------------------------------\n\nSee http://www.cs.diamond.ac.uk/reports/gitlab-ci/dls-logformatter/index.html for more detailed documentation.\n\nBuilding and viewing the documents locally::\n\n    git clone git+https://gitlab.diamond.ac.uk/scisoft/dls-logformatter.git \n    cd dls-logformatter\n    virtualenv /scratch/$USER/venv/dls-logformatter\n    source /scratch/$USER/venv/dls-logformatter/bin/activate \n    pip install -e .[dev,docs]\n    make -f .dls-logformatter/Makefile validate_docs\n    browse to file:///scratch/$USER/venvs/dls-logformatter/build/html/index.html\n\nTopics for further documentation:\n\n- TODO list of improvements\n- change log\n\n\n..\n    Anything below this line is used when viewing README.rst and will be replaced\n    when included in index.rst\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiamondlightsource%2Fdls-logformatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiamondlightsource%2Fdls-logformatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiamondlightsource%2Fdls-logformatter/lists"}