lognostic


Namelognostic JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://Mamdasn.github.io/lognostic
Summarylognostic is a lightweight, efficient Python package designed to seamlessly integrate into existing Python applications to provide comprehensive logging statistics. ThiThis package caters to development teams seeking to optimize logging performance, diagnose issues, and understand logging loads without introducing significant overhead or complexity into their applications.
upload_time2024-03-08 21:20:15
maintainer
docs_urlNone
authorMamdasan Sabrian
requires_python>=3.9,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lognostic

[![PyPI](https://img.shields.io/pypi/v/lognostic?style=flat-square)](https://pypi.python.org/pypi/lognostic/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lognostic?style=flat-square)](https://pypi.python.org/pypi/lognostic/)
[![PyPI - License](https://img.shields.io/pypi/l/lognostic?style=flat-square)](https://pypi.python.org/pypi/lognostic/)


---

**Documentation**: [https://Mamdasn.github.io/lognostic](https://Mamdasn.github.io/lognostic)

**Source Code**: [https://github.com/Mamdasn/lognostic](https://github.com/Mamdasn/lognostic)

**PyPI**: [https://pypi.org/project/lognostic/](https://pypi.org/project/lognostic/)

---

`lognostic` is a lightweight, efficient Python package designed to seamlessly integrate into existing Python applications to provide logging statistics. This package caters to development teams seeking to optimize logging performance, diagnose issues, and understand logging loads without introducing significant overhead or complexity into their applications.

## Installation

```sh
pip install lognostic
```

## Development

* Clone this repository
* Requirements:
  * [Poetry](https://python-poetry.org/)
  * Python 3.9+
* Create a virtual environment and install the dependencies

```sh
poetry install
```

* Activate the virtual environment

```sh
poetry shell
```

### Custom logging Handler

The `lognostic` module can be integrated into logging subsystems by employing a custom logging handler:

```python
class LogHandler(logging.Handler):
    def __init__(self, lognostic: Lognostic):
        super().__init__()
        self._lognostic = lognostic

    def emit(self, log_record: logging.LogRecord):
        self._lognostic.record(log_record)
```

A `Lognostic` instance should be given to the custom logging handler, so later logging statistics can be obtained:

```python
lognostic = Lognostic()
loghandler = LogHandler(lognostic)
logger.addHandler(loghandler)

logger.info('This is a test log message')

lognostic.total_size() # -> returns 26
```

### Documentation

The documentation is automatically generated from the content of the [docs directory](./docs) and from the docstrings found in the source code.


### Testing
Run unit tests using
```sh
pytest tests
```

> **_Automated test runs_**: The `lognostic` package is automatically tested through python versions 3.9 to 3.12 using GitHub's CI/CD pipeline.

### Docker Usage

Build the image of the Dockerfile using
```sh
docker build -t lognostic .
```
Run the image with
```sh
docker run --name lognostic_instance lognostic
```

> The docker builds the envioronment followed by running the pre-commits and unit tests.

### Pre-commit

Pre-commit hooks run all the auto-formatters (e.g. `black`, `isort`), linters (e.g. `mypy`, `flake8`), and other quality checks to make sure the changeset is in good shape before a commit/push happens.

You can install the hooks with (runs for each commit):

```sh
pre-commit install
```

Or if you want them to run only for each push:

```sh
pre-commit install -t pre-push
```

Or if you want e.g. want to run all checks manually for all files:

```sh
pre-commit run --all-files
```

## Future features and improvements
+ Data persistency: Store statistics on the disk persistency for future historical logging analysis.
+ Logging Dashboard: A web dashboard to visualize logging statistics in real-time, allowing teams to monitor logging load dynamically.
+ Throw warning/error messages if certain logging thresholds are met, such as an unusually high logging rate, to quickly identify potential issues.
---

This project was generated using the [python-package-cookiecutter](https://github.com/Mamdasn/python-package-cookiecutter) template.

            

Raw data

            {
    "_id": null,
    "home_page": "https://Mamdasn.github.io/lognostic",
    "name": "lognostic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Mamdasan Sabrian",
    "author_email": "reach.s.farhad@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/da/cf/adb03f63113337684f70fc1d1300ec47d32cfe42c3b80eae330a7dc70859/lognostic-0.0.4.tar.gz",
    "platform": null,
    "description": "# lognostic\n\n[![PyPI](https://img.shields.io/pypi/v/lognostic?style=flat-square)](https://pypi.python.org/pypi/lognostic/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lognostic?style=flat-square)](https://pypi.python.org/pypi/lognostic/)\n[![PyPI - License](https://img.shields.io/pypi/l/lognostic?style=flat-square)](https://pypi.python.org/pypi/lognostic/)\n\n\n---\n\n**Documentation**: [https://Mamdasn.github.io/lognostic](https://Mamdasn.github.io/lognostic)\n\n**Source Code**: [https://github.com/Mamdasn/lognostic](https://github.com/Mamdasn/lognostic)\n\n**PyPI**: [https://pypi.org/project/lognostic/](https://pypi.org/project/lognostic/)\n\n---\n\n`lognostic` is a lightweight, efficient Python package designed to seamlessly integrate into existing Python applications to provide logging statistics. This package caters to development teams seeking to optimize logging performance, diagnose issues, and understand logging loads without introducing significant overhead or complexity into their applications.\n\n## Installation\n\n```sh\npip install lognostic\n```\n\n## Development\n\n* Clone this repository\n* Requirements:\n  * [Poetry](https://python-poetry.org/)\n  * Python 3.9+\n* Create a virtual environment and install the dependencies\n\n```sh\npoetry install\n```\n\n* Activate the virtual environment\n\n```sh\npoetry shell\n```\n\n### Custom logging Handler\n\nThe `lognostic` module can be integrated into logging subsystems by employing a custom logging handler:\n\n```python\nclass LogHandler(logging.Handler):\n    def __init__(self, lognostic: Lognostic):\n        super().__init__()\n        self._lognostic = lognostic\n\n    def emit(self, log_record: logging.LogRecord):\n        self._lognostic.record(log_record)\n```\n\nA `Lognostic` instance should be given to the custom logging handler, so later logging statistics can be obtained:\n\n```python\nlognostic = Lognostic()\nloghandler = LogHandler(lognostic)\nlogger.addHandler(loghandler)\n\nlogger.info('This is a test log message')\n\nlognostic.total_size() # -> returns 26\n```\n\n### Documentation\n\nThe documentation is automatically generated from the content of the [docs directory](./docs) and from the docstrings found in the source code.\n\n\n### Testing\nRun unit tests using\n```sh\npytest tests\n```\n\n> **_Automated test runs_**: The `lognostic` package is automatically tested through python versions 3.9 to 3.12 using GitHub's CI/CD pipeline.\n\n### Docker Usage\n\nBuild the image of the Dockerfile using\n```sh\ndocker build -t lognostic .\n```\nRun the image with\n```sh\ndocker run --name lognostic_instance lognostic\n```\n\n> The docker builds the envioronment followed by running the pre-commits and unit tests.\n\n### Pre-commit\n\nPre-commit hooks run all the auto-formatters (e.g. `black`, `isort`), linters (e.g. `mypy`, `flake8`), and other quality checks to make sure the changeset is in good shape before a commit/push happens.\n\nYou can install the hooks with (runs for each commit):\n\n```sh\npre-commit install\n```\n\nOr if you want them to run only for each push:\n\n```sh\npre-commit install -t pre-push\n```\n\nOr if you want e.g. want to run all checks manually for all files:\n\n```sh\npre-commit run --all-files\n```\n\n## Future features and improvements\n+ Data persistency: Store statistics on the disk persistency for future historical logging analysis.\n+ Logging Dashboard: A web dashboard to visualize logging statistics in real-time, allowing teams to monitor logging load dynamically.\n+ Throw warning/error messages if certain logging thresholds are met, such as an unusually high logging rate, to quickly identify potential issues.\n---\n\nThis project was generated using the [python-package-cookiecutter](https://github.com/Mamdasn/python-package-cookiecutter) template.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "lognostic is a lightweight, efficient Python package designed to seamlessly integrate into existing Python applications to provide comprehensive logging statistics. ThiThis package caters to development teams seeking to optimize logging performance, diagnose issues, and understand logging loads without introducing significant overhead or complexity into their applications.",
    "version": "0.0.4",
    "project_urls": {
        "Documentation": "https://Mamdasn.github.io/lognostic",
        "Homepage": "https://Mamdasn.github.io/lognostic",
        "Repository": "https://github.com/Mamdasn/lognostic"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c18125292c01f1d05288f929c83203d086ab359f0f6e54ddf994f0d760cf598",
                "md5": "55ae9bb2bd2b5ffb264d6be2ebf10650",
                "sha256": "6a43dcbb79099cb8b31663dba7e94fc394eb77f9c9726eefaacaa69973487da0"
            },
            "downloads": -1,
            "filename": "lognostic-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "55ae9bb2bd2b5ffb264d6be2ebf10650",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 5193,
            "upload_time": "2024-03-08T21:20:14",
            "upload_time_iso_8601": "2024-03-08T21:20:14.205942Z",
            "url": "https://files.pythonhosted.org/packages/6c/18/125292c01f1d05288f929c83203d086ab359f0f6e54ddf994f0d760cf598/lognostic-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dacfadb03f63113337684f70fc1d1300ec47d32cfe42c3b80eae330a7dc70859",
                "md5": "467c2e7a03f18b4d4afecb73c01fb5fe",
                "sha256": "e1c6767def343d3f26726d6de7e15940316002c4c62ace640947e25c2a12d5b8"
            },
            "downloads": -1,
            "filename": "lognostic-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "467c2e7a03f18b4d4afecb73c01fb5fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 4981,
            "upload_time": "2024-03-08T21:20:15",
            "upload_time_iso_8601": "2024-03-08T21:20:15.805380Z",
            "url": "https://files.pythonhosted.org/packages/da/cf/adb03f63113337684f70fc1d1300ec47d32cfe42c3b80eae330a7dc70859/lognostic-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-08 21:20:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Mamdasn",
    "github_project": "lognostic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lognostic"
}
        
Elapsed time: 0.19568s