{"id":17848461,"url":"https://github.com/betodealmeida/consolelog","last_synced_at":"2025-03-20T07:31:56.435Z","repository":{"id":53709844,"uuid":"126239059","full_name":"betodealmeida/consolelog","owner":"betodealmeida","description":"Log to browser console from Python","archived":false,"fork":false,"pushed_at":"2022-12-27T15:33:37.000Z","size":358,"stargazers_count":9,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-26T03:23:31.953Z","etag":null,"topics":["browser","console","logging","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betodealmeida.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}},"created_at":"2018-03-21T20:50:42.000Z","updated_at":"2023-10-27T15:33:35.000Z","dependencies_parsed_at":"2023-01-31T04:16:44.816Z","dependency_job_id":null,"html_url":"https://github.com/betodealmeida/consolelog","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/betodealmeida%2Fconsolelog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betodealmeida%2Fconsolelog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betodealmeida%2Fconsolelog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betodealmeida%2Fconsolelog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betodealmeida","download_url":"https://codeload.github.com/betodealmeida/consolelog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221738998,"owners_count":16872698,"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":["browser","console","logging","python"],"created_at":"2024-10-27T22:22:23.030Z","updated_at":"2024-10-27T22:22:23.458Z","avatar_url":"https://github.com/betodealmeida.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# console_log #\n\nThis module provides a WSGI middleware that allows you to log to the browser console from Python:\n\n```python\nimport logging\n\nfrom flask import Flask\n\nfrom console_log import ConsoleLog\n\nconsole = logging.getLogger('console')\nconsole.setLevel(logging.DEBUG)\n\napp = Flask(__name__)\n\n@app.route('/')\ndef hello():\n    logger.error('Error logged from Python')\n    logger.warning('Warning logged from Python')\n    logger.info('Info logged from Python')\n    logger.debug('Debug logged from Python')\n    logger.debug({'foo': ['bar', 'baz']})\n    return \"Hello World!\"\n\napp.wsgi_app = ConsoleLog(app.wsgi_app, console)\n```\n\nThe logged messages will then show up in the browser console:\n\n![Example showing messages in console](https://github.com/betodealmeida/consolelog/blob/master/docs/console_log.png)\n\n# How it works #\n\nThe new WSGI app does two things:\n\n1. Creates a websocket backchannel.\n2. Injects Javascript code into HTML responses, fetching data from the websocket channel and logging them to console.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetodealmeida%2Fconsolelog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetodealmeida%2Fconsolelog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetodealmeida%2Fconsolelog/lists"}