{"id":45901689,"url":"https://github.com/cheesecaketv/swiftgui-logging","last_synced_at":"2026-03-02T01:00:55.031Z","repository":{"id":340181154,"uuid":"1164933998","full_name":"CheesecakeTV/SwiftGUI-Logging","owner":"CheesecakeTV","description":"A collection of helpful logging-functionality based on the logging package","archived":false,"fork":false,"pushed_at":"2026-02-26T11:32:48.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-28T02:26:21.492Z","etag":null,"topics":["crash","crash-reporting","crashlog","logging","logging-library","python","swiftgui"],"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/CheesecakeTV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-23T16:40:20.000Z","updated_at":"2026-02-26T11:32:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/CheesecakeTV/SwiftGUI-Logging","commit_stats":null,"previous_names":["cheesecaketv/swiftgui-logging"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CheesecakeTV/SwiftGUI-Logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheesecakeTV%2FSwiftGUI-Logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheesecakeTV%2FSwiftGUI-Logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheesecakeTV%2FSwiftGUI-Logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheesecakeTV%2FSwiftGUI-Logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CheesecakeTV","download_url":"https://codeload.github.com/CheesecakeTV/SwiftGUI-Logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheesecakeTV%2FSwiftGUI-Logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29955885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["crash","crash-reporting","crashlog","logging","logging-library","python","swiftgui"],"created_at":"2026-02-27T23:21:22.275Z","updated_at":"2026-03-01T00:00:25.891Z","avatar_url":"https://github.com/CheesecakeTV.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# SwiftGUI-Logging: Motivation\nA small package ment to extend logging to better fit actual applications.\n\nBefore getting into the logging-package, I usually implemented \nsomething like this (but more complicated):\n```py\ndef main():\n    ...\n\nif __name__ == \"__main__\":\n    try:\n        main()  # Run the main program\n    except Exception as ex: # An exception occured\n        with open(\"Crashlog.txt\", \"w\") as f:    # Save exception to file\n            f.write(str(ex))\n```\nIf `main()` causes an exception, the file `Crashlog.txt` is created\ncontaining information about the exception.\nThat means, only \"the interesting logs\" take up storage space.\n\nUnfortunately, you can't implement such a functionality using the \nlogging-package.\n\nUntil now.\n\nSwiftGUI-Logging provides a very easy way to set up crashlogs that \nare fully compatible with the logging-package.\n\n# Basic usage\n## Installation\nInstall the package by running this on your terminal:\n```bash\npip install SwiftGUI_Logging\n```\n\n## Crashlogging to a file\nSimply call `SwiftGUI_Logging.Configs.exceptions_to_file(filepath)` \nto set up the crashlogger.\n\nThat's all.\n\nExample:\n```py\nimport time\nimport SwiftGUI_Logging as sgl\nimport logging\n\ndef main():\n    for i in range(10):\n        logging.debug(f\"Test {i}\")\n        print(i)\n        time.sleep(0.25)\n\n    logging.info(\"Crashing the program now\")\n\n    1 / 0   # Cause a ZeroDivisionError, which crashes the program\n\nif __name__ == '__main__':\n    sgl.Configs.exceptions_to_file(\"Crashlogs/Crash.log\") # Set up the crash-log\n    main()  # Execute program\n```\n\nYou'll find that the directory `Crashlogs` was created.\nAfter the program executes, the directory contains a file like\n`Crash_2026-02-24_16-33-52.log`.\n\nAs you can see, the time of the crash was inserted into the \nfilename, so that multiple crashlogs don't overwrite each other.\n\nThe file contains the most recent log-entries (from `logging.debug` and `logging.info`)\nand the exception with full traceback:\n```log\n2026-02-24 16:33:49,940 - root - DEBUG - Test 0\n2026-02-24 16:33:50,197 - root - DEBUG - Test 1\n2026-02-24 16:33:50,451 - root - DEBUG - Test 2\n2026-02-24 16:33:50,704 - root - DEBUG - Test 3\n2026-02-24 16:33:50,958 - root - DEBUG - Test 4\n2026-02-24 16:33:51,214 - root - DEBUG - Test 5\n2026-02-24 16:33:51,469 - root - DEBUG - Test 6\n2026-02-24 16:33:51,723 - root - DEBUG - Test 7\n2026-02-24 16:33:51,979 - root - DEBUG - Test 8\n2026-02-24 16:33:52,235 - root - DEBUG - Test 9\n2026-02-24 16:33:52,490 - root - INFO - Crashing the program now\n2026-02-24 16:33:52,490 - root - ERROR - Traceback (most recent call last):\n  File \"C:\\Users\\chees\\PycharmProjects\\SwiftGUI-Logging\\tests\\test.py\", line 17, in \u003cmodule\u003e\n    main()  # Execute program\n  File \"C:\\Users\\chees\\PycharmProjects\\SwiftGUI-Logging\\tests\\test.py\", line 13, in main\n    1 / 0   # Cause a ZeroDivisionError, which crashes the program\nZeroDivisionError: division by zero\n```\n\n`sgl.Configs.exceptions_to_file` can do a bit more, but for most programs,\nthe default configuration is fine.\n\n## Other functionality\n`SwiftGUI_Logging` provides some other functionality, but these\naren't nearly as important as the `exceptions_to_file`-function.\n\nA detailed documentation will follow.\n\n# SwiftGUI\nThis package was written as an addition to \nmy Python GUI-package `SwiftGUI`:\nhttps://github.com/CheesecakeTV/SwiftGUI\n\nSince `SwiftGUI_Logging` itself has nothing to to with GUIs, \nit is its own package.\n\nConsider checking out `SwiftGUI` if you want to easily create \nuser-interfaces for python.\nIf you already know the package `PySimpleGUI`, you'll learn the \nbasics of`SwiftGUI` with little to no effort.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheesecaketv%2Fswiftgui-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheesecaketv%2Fswiftgui-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheesecaketv%2Fswiftgui-logging/lists"}