{"id":17166601,"url":"https://github.com/miso-belica/diagnostics","last_synced_at":"2025-04-13T15:13:49.931Z","repository":{"id":6866895,"uuid":"8115836","full_name":"miso-belica/diagnostics","owner":"miso-belica","description":"Alternative to Python's module `cgitb` with template inspired by http://nette.org/ and https://www.djangoproject.com/","archived":false,"fork":false,"pushed_at":"2017-03-04T13:30:21.000Z","size":63,"stargazers_count":14,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"dev","last_synced_at":"2025-03-26T23:17:39.805Z","etag":null,"topics":["debugger","debugger-visualizer","logging","python","sentry"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/diagnostics/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miso-belica.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.rst","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-09T22:07:46.000Z","updated_at":"2021-05-22T14:25:12.000Z","dependencies_parsed_at":"2022-09-18T10:43:00.546Z","dependency_job_id":null,"html_url":"https://github.com/miso-belica/diagnostics","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-belica%2Fdiagnostics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-belica%2Fdiagnostics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-belica%2Fdiagnostics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-belica%2Fdiagnostics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miso-belica","download_url":"https://codeload.github.com/miso-belica/diagnostics/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732488,"owners_count":21152852,"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":["debugger","debugger-visualizer","logging","python","sentry"],"created_at":"2024-10-14T23:06:07.527Z","updated_at":"2025-04-13T15:13:49.899Z","avatar_url":"https://github.com/miso-belica.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===========\nDiagnostics\n===========\n.. image:: https://api.travis-ci.org/miso-belica/diagnostics.png?branch=master\n   :target: https://travis-ci.org/miso-belica/diagnostics\n\nModule for logging of `detailed traceback\n\u003chttp://miso-belica.github.io/diagnostics/log-example.html\u003e`_ as HTML page.\nUnexpected exceptions are catched and logged for further audit. Exceptions\nin diagnostic's exception handler are properly handled and logged\n(but formatted only as standard Python traceback). Usage is simple as code below.\n\n.. code-block:: python\n\n    from diagnostics import exception_hook\n\n    if __name__ == '__main__':\n        # you have to create \"log/\" directory next to file that is your main module\n        exception_hook.enable()\n\n.. code-block:: python\n\n    from diagnostics import exception_hook\n    from diagnostics.storages import FileStorage\n\n    if __name__ == '__main__':\n        # or simply set your own storage\n        directory_path = \"/path/to/your/log/directory/with/html/tracebacks\"\n        exception_hook.enable(storage=FileStorage(directory_path))\n\n.. code-block:: python\n\n    from diagnostics import exception_hook\n\n    if __name__ == '__main__':\n        with exception_hook:\n            try_do_risky_job(...)\n\nThere is even support for logging in diagnostics. Class\n``diagnostics.logging.FileHandler`` creates files with detailed traceback\nand log messages are appended to the file *info.log* in directory with\nlogged tracebacks.\n\n.. code-block:: python\n\n    import logging\n\n    from diagnostics import exception_hook\n    from diagnostics.logging import FileHandler\n\n    if __name__ == '__main__':\n        file_path = \"/path/to/log/directory/with/html/tracebacks/info.log\"\n        log_handler = FileHandler(file_path)\n        exception_hook.enable_for_logger(logging.getLogger(), handler=log_handler)\n\n        try:\n            try_do_risky_job(...)\n        except:\n            logging.exception(\"Risky job failed\")\n\n.. code-block:: python\n\n    import logging\n\n    from diagnostics import exception_hook\n    from diagnostics.logging import FileHandler\n\n    if __name__ == '__main__':\n        file_path = \"/path/to/log/directory/with/html/tracebacks/info.log\"\n        log_handler = FileHandler(file_path)\n        exception_hook.enable_for_logger(\"example_logger\", handler=log_handler)\n\n        try:\n            try_do_risky_job(...)\n        except:\n            logger = logging.getLogger(\"example_logger\")\n            logger.error(\"Error occured\", exc_info=True)\n\nInstallation\n------------\nFrom PyPI\n::\n\n    pip install diagnostics\n\nor from git repo\n::\n\n    pip install git+git://github.com/miso-belica/diagnostics.git\n\nTests\n-----\nRun tests via\n\n.. code-block:: bash\n\n    $ nosetests-2.6 \u0026\u0026 nosetests-3.2 \u0026\u0026 nosetests-2.7 \u0026\u0026 nosetests-3.3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiso-belica%2Fdiagnostics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiso-belica%2Fdiagnostics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiso-belica%2Fdiagnostics/lists"}