# Bug Trail
<img src="./img/logo.png" width="100" height="100">
This is a workstation logger to capture bugs encountered while you are writing code.
In other words, it is an HTML report writer for your logs, even if they aren't errors if that is your thing.
## Installation
The handlers in `bug-trail-core` support python 3.9+. `bug-trail`, the report viewer supports python 3.11 and should
be installed apart from your main app.
Install bug-trail-core with your app. It has as few dependencies as I could manage.
```bash
pip install bug-trail-core
````
To generate the static website install this in an isolated global virtual environment.
```bash
pipx install bug-trail
```
## Usage
Configuration is optional via a `pyproject.toml` file and the logging modules ordinary configuration options. See
[example code-as-config](example_code_as_config.py)
This is the schema with the default values.
```toml
[tool.bug-trail]
app_name = "bug_trail"
app_author = "bug_trail"
report_folder = "logs"
database_path = "bug_trail.db"
```
```python
import bug_trail_core
import logging
section = bug_trail_core.read_config(config_path="../pyproject.toml")
handler = bug_trail_core.BugTrailHandler(
section.database_path, minimum_level=logging.ERROR
)
logging.basicConfig(handlers=[handler], level=logging.ERROR)
logger = logging.getLogger(__name__)
logger.error("This is an error message")
```
To generate to the log folder relative to the current working directory:
```bash
bug_trail --output logs --db error_log.db
```
## Picologging
If you want to use picologging, install it. Everything is the same except you use the `PicoBugTrailHandler`.
```python
import bug_trail_core
import logging
section = bug_trail_core.read_config(config_path="../pyproject.toml")
handler = bug_trail_core.PicoBugTrailHandler(
section.database_path, minimum_level=logging.ERROR
)
logging.basicConfig(handlers=[handler], level=logging.ERROR)
logger = logging.getLogger(__name__)
logger.error("This is an error message")
```
## Do more with your data
```bash
pipx install datasette
datasette bug_trail.db
```
## Security
None. Do not publish your error log to the internet or to public Github. Add the log folder to your .gitignore file.
## Advanced
Get ctags from [here](https://github.com/universal-ctags/ctags)
```bash
./ctags -R -f fish_tank.tags fish_tank
```
## Prior Art
Inspired by elmah. `bug_trail` is much less ambitious, as this is just a browsable, static HTML report.
If you want logger for a website, hosted in your Flak or Django website:
- [Flask-ErrorsHandler](https://pypi.org/project/Flask-ErrorsHandler/)
- [django-elmah](https://pypi.org/project/django-elmah/)
These are the closest "write logs to HTML" projects I could find:
- [PyLog2html](https://pypi.org/project/PyLog2html/)
- Gist - https://gist.github.com/ColinDuquesnoy/8296508
- [dblogging](https://gitlab.com/tspens/dblogging) - Uses sqlite, but does not use standard library logging framework
If you want someone else to do it all for you
- [Sentry](https://sentry.io/)
Raw data
{
"_id": null,
"home_page": "https://github.com/matthewdeanmartin/bug_trail",
"name": "bug-trail",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": "",
"keywords": "error logging,html log report",
"author": "Matthew Martin",
"author_email": "matthewdeanmartin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/53/64/339d8de41c7b09609df053b2e219225d5e0155a262db2a08fc72fea66165/bug_trail-2.3.0.tar.gz",
"platform": null,
"description": "# Bug Trail\n\n<img src=\"./img/logo.png\" width=\"100\" height=\"100\">\n\nThis is a workstation logger to capture bugs encountered while you are writing code.\n\nIn other words, it is an HTML report writer for your logs, even if they aren't errors if that is your thing.\n\n## Installation\n\nThe handlers in `bug-trail-core` support python 3.9+. `bug-trail`, the report viewer supports python 3.11 and should \nbe installed apart from your main app.\n\nInstall bug-trail-core with your app. It has as few dependencies as I could manage.\n```bash\npip install bug-trail-core\n````\n\nTo generate the static website install this in an isolated global virtual environment.\n```bash\npipx install bug-trail\n```\n\n## Usage\n\nConfiguration is optional via a `pyproject.toml` file and the logging modules ordinary configuration options. See \n[example code-as-config](example_code_as_config.py)\n\nThis is the schema with the default values.\n```toml\n[tool.bug-trail]\napp_name = \"bug_trail\"\napp_author = \"bug_trail\"\nreport_folder = \"logs\"\ndatabase_path = \"bug_trail.db\"\n```\n\n\n```python\nimport bug_trail_core\nimport logging\n\nsection = bug_trail_core.read_config(config_path=\"../pyproject.toml\")\nhandler = bug_trail_core.BugTrailHandler(\n section.database_path, minimum_level=logging.ERROR\n)\nlogging.basicConfig(handlers=[handler], level=logging.ERROR)\n\nlogger = logging.getLogger(__name__)\nlogger.error(\"This is an error message\")\n```\n\nTo generate to the log folder relative to the current working directory:\n\n```bash\nbug_trail --output logs --db error_log.db\n```\n\n## Picologging\nIf you want to use picologging, install it. Everything is the same except you use the `PicoBugTrailHandler`.\n\n```python\nimport bug_trail_core\nimport logging\n\nsection = bug_trail_core.read_config(config_path=\"../pyproject.toml\")\nhandler = bug_trail_core.PicoBugTrailHandler(\n section.database_path, minimum_level=logging.ERROR\n)\nlogging.basicConfig(handlers=[handler], level=logging.ERROR)\n\nlogger = logging.getLogger(__name__)\nlogger.error(\"This is an error message\")\n```\n\n## Do more with your data\n\n```bash\npipx install datasette\ndatasette bug_trail.db\n```\n\n## Security\nNone. Do not publish your error log to the internet or to public Github. Add the log folder to your .gitignore file.\n\n## Advanced\nGet ctags from [here](https://github.com/universal-ctags/ctags)\n```bash\n./ctags -R -f fish_tank.tags fish_tank\n```\n\n## Prior Art\nInspired by elmah. `bug_trail` is much less ambitious, as this is just a browsable, static HTML report.\n\nIf you want logger for a website, hosted in your Flak or Django website:\n- [Flask-ErrorsHandler](https://pypi.org/project/Flask-ErrorsHandler/)\n- [django-elmah](https://pypi.org/project/django-elmah/)\n\nThese are the closest \"write logs to HTML\" projects I could find:\n- [PyLog2html](https://pypi.org/project/PyLog2html/)\n- Gist - https://gist.github.com/ColinDuquesnoy/8296508\n- [dblogging](https://gitlab.com/tspens/dblogging) - Uses sqlite, but does not use standard library logging framework\n\nIf you want someone else to do it all for you\n- [Sentry](https://sentry.io/)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Local static html error logger to use while developing python code.",
"version": "2.3.0",
"project_urls": {
"Bug Tracker": "https://github.com/matthewdeanmartin/bug_trail/issues",
"Change Log": "https://github.com/matthewdeanmartin/bug_trail/blob/main/CHANGES.md",
"Documentation": "https://github.com/matthewdeanmartin/bug_trail",
"Homepage": "https://github.com/matthewdeanmartin/bug_trail",
"Repository": "https://github.com/matthewdeanmartin/bug_trail"
},
"split_keywords": [
"error logging",
"html log report"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "890bfadeabc5481c440343874f8d7f515c2a5f09d2fb823487b0c7178f637688",
"md5": "90fbed70ffa246cfc256bb8247aff539",
"sha256": "d2cbeb6a59b76295cd3f33c0bd242d11a92944f1781522f1afedbd2e93cd73b3"
},
"downloads": -1,
"filename": "bug_trail-2.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "90fbed70ffa246cfc256bb8247aff539",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 263795,
"upload_time": "2024-01-10T02:17:01",
"upload_time_iso_8601": "2024-01-10T02:17:01.567389Z",
"url": "https://files.pythonhosted.org/packages/89/0b/fadeabc5481c440343874f8d7f515c2a5f09d2fb823487b0c7178f637688/bug_trail-2.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5364339d8de41c7b09609df053b2e219225d5e0155a262db2a08fc72fea66165",
"md5": "67a4326e848310ef989306bee451de46",
"sha256": "4b8aa616c83e0910ce423ad8f24cc8506514b1068fe5383d95035dc5c2978821"
},
"downloads": -1,
"filename": "bug_trail-2.3.0.tar.gz",
"has_sig": false,
"md5_digest": "67a4326e848310ef989306bee451de46",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 261258,
"upload_time": "2024-01-10T02:17:03",
"upload_time_iso_8601": "2024-01-10T02:17:03.925631Z",
"url": "https://files.pythonhosted.org/packages/53/64/339d8de41c7b09609df053b2e219225d5e0155a262db2a08fc72fea66165/bug_trail-2.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-10 02:17:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "matthewdeanmartin",
"github_project": "bug_trail",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bug-trail"
}