py-extensions-alogging


Namepy-extensions-alogging JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/py-extensions/alogging
SummaryAsync Logging for Python
upload_time2024-03-01 01:30:04
maintainer
docs_urlNone
authorYury Sokov
requires_python>=3.9,<4.0
licenseMIT
keywords logging async asyncio python py-extensions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # alogging

`alogging` is a Python library that provides asynchronous logging capabilities. It is designed to work with the standard Python `logging` module, but adds asynchronous functionality to improve performance in applications that make heavy use of logging.

## Features

- Asynchronous logging: Log messages are processed in a separate process to avoid blocking the main application.
- Compatibility: Works with the standard Python `logging` module, so you can use all the features and handlers you're familiar with.
- Flexibility: Provides a variety of handlers, including `RotatingFileHandler`, `HTTPHandler`, `SMTPHandler`, `SysLogHandler`, and more.

## Usage

To use `alogging`, you first need to start the backend process. This can be done using the `start_backend` method:

```python
import asyncio
import alogging

asyncio.run(alogging.start_backend())
```

You can then get a logger and use it just like you would with the standard `logging` module:

```python3
log = alogging.getLogger("my_logger")
log.info("This is an info message")
```

You can also configure the logger using the `basicConfig` function:

```python3
alogging.basicConfig(
    filename="test.log",
    level=alogging.DEBUG,
    format="%(name)s - %(levelname)s - %(message)s",
)
```

## Handlers

`alogging` provides a variety of handlers that you can use to control where your log messages go. These include:

- `RotatingFileHandler`: Writes log messages to a file, with support for automatic rotation when the file reaches a certain size.
- `HTTPHandler`: Sends log messages to a web server as HTTP POST requests.
- `SMTPHandler`: Sends log messages to an email address using SMTP.
- `SysLogHandler`: Sends log messages to a Unix syslog daemon.

To use a handler, you need to create an instance of it and add it to your logger:

```python3
handler = alogging.handlers.RotatingFileHandler("test.log", maxBytes=10000, backupCount=5)
log.addHandler(handler)
```

## Installation

You can install `alogging` using pip:

```
pip install py-extensions-alogging
```

Or add it using poetry:

```
poetry add py-extensions-alogging
```

## Contributing

Contributions to `alogging` are welcome. Please submit a pull request or create an issue on GitHub.

## License

`alogging` is licensed under the MIT License. See [LICENSE](LICENSE) for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/py-extensions/alogging",
    "name": "py-extensions-alogging",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "logging,async,asyncio,python,py-extensions",
    "author": "Yury Sokov",
    "author_email": "me@yurzs.dev",
    "download_url": "https://files.pythonhosted.org/packages/7f/e7/83c05429a60d54cc5f2034f317086034393197034f9b5ddffef7cbc7eb97/py_extensions_alogging-0.1.1.tar.gz",
    "platform": null,
    "description": "# alogging\n\n`alogging` is a Python library that provides asynchronous logging capabilities. It is designed to work with the standard Python `logging` module, but adds asynchronous functionality to improve performance in applications that make heavy use of logging.\n\n## Features\n\n- Asynchronous logging: Log messages are processed in a separate process to avoid blocking the main application.\n- Compatibility: Works with the standard Python `logging` module, so you can use all the features and handlers you're familiar with.\n- Flexibility: Provides a variety of handlers, including `RotatingFileHandler`, `HTTPHandler`, `SMTPHandler`, `SysLogHandler`, and more.\n\n## Usage\n\nTo use `alogging`, you first need to start the backend process. This can be done using the `start_backend` method:\n\n```python\nimport asyncio\nimport alogging\n\nasyncio.run(alogging.start_backend())\n```\n\nYou can then get a logger and use it just like you would with the standard `logging` module:\n\n```python3\nlog = alogging.getLogger(\"my_logger\")\nlog.info(\"This is an info message\")\n```\n\nYou can also configure the logger using the `basicConfig` function:\n\n```python3\nalogging.basicConfig(\n    filename=\"test.log\",\n    level=alogging.DEBUG,\n    format=\"%(name)s - %(levelname)s - %(message)s\",\n)\n```\n\n## Handlers\n\n`alogging` provides a variety of handlers that you can use to control where your log messages go. These include:\n\n- `RotatingFileHandler`: Writes log messages to a file, with support for automatic rotation when the file reaches a certain size.\n- `HTTPHandler`: Sends log messages to a web server as HTTP POST requests.\n- `SMTPHandler`: Sends log messages to an email address using SMTP.\n- `SysLogHandler`: Sends log messages to a Unix syslog daemon.\n\nTo use a handler, you need to create an instance of it and add it to your logger:\n\n```python3\nhandler = alogging.handlers.RotatingFileHandler(\"test.log\", maxBytes=10000, backupCount=5)\nlog.addHandler(handler)\n```\n\n## Installation\n\nYou can install `alogging` using pip:\n\n```\npip install py-extensions-alogging\n```\n\nOr add it using poetry:\n\n```\npoetry add py-extensions-alogging\n```\n\n## Contributing\n\nContributions to `alogging` are welcome. Please submit a pull request or create an issue on GitHub.\n\n## License\n\n`alogging` is licensed under the MIT License. See [LICENSE](LICENSE) for more information.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Async Logging for Python",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/py-extensions/alogging",
        "Repository": "https://github.com/py-extensions/alogging"
    },
    "split_keywords": [
        "logging",
        "async",
        "asyncio",
        "python",
        "py-extensions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4692a39f03f224591c06f054f9de85d9e0528ce991f5fce88bb9d50e376eaa6c",
                "md5": "780eec1e837e49b425973080ee239271",
                "sha256": "6f3945e8dd2d9a70f206ac8ec22c0186891ec7d2a7aa7c637d8fccf081c7f877"
            },
            "downloads": -1,
            "filename": "py_extensions_alogging-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "780eec1e837e49b425973080ee239271",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 7030,
            "upload_time": "2024-03-01T01:29:59",
            "upload_time_iso_8601": "2024-03-01T01:29:59.267457Z",
            "url": "https://files.pythonhosted.org/packages/46/92/a39f03f224591c06f054f9de85d9e0528ce991f5fce88bb9d50e376eaa6c/py_extensions_alogging-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7fe783c05429a60d54cc5f2034f317086034393197034f9b5ddffef7cbc7eb97",
                "md5": "6cc8502425b86eb7423b4adf67f2eb60",
                "sha256": "e705a8aeeeba0177aa3eef2b8f45e762b3d9ad139085d088841762542e32c078"
            },
            "downloads": -1,
            "filename": "py_extensions_alogging-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6cc8502425b86eb7423b4adf67f2eb60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 5791,
            "upload_time": "2024-03-01T01:30:04",
            "upload_time_iso_8601": "2024-03-01T01:30:04.134273Z",
            "url": "https://files.pythonhosted.org/packages/7f/e7/83c05429a60d54cc5f2034f317086034393197034f9b5ddffef7cbc7eb97/py_extensions_alogging-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-01 01:30:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "py-extensions",
    "github_project": "alogging",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "py-extensions-alogging"
}
        
Elapsed time: 0.21681s