mlogconfig


Namemlogconfig JSON
Version 0.2.5 PyPI version JSON
download
home_page
SummaryThis module provides a configurable logging setup for Python applications. It supports logging to console, file, syslog (for Linux and macOS), and Windows Event Log. The user can enable or disable each logging method as needed.
upload_time2023-06-09 22:23:13
maintainer
docs_urlNone
authorMatt
requires_python>=3.7,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # [mlogconfig.py](mlogconfig.py)

[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
[![PyPI](https://img.shields.io/pypi/v/mlogconfig?label=PyPI%20Package%20Version)](https://pypi.org/project/mlogconfig/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/mlogconfig?color=blue)
[![CodeQL](https://github.com/talltechy/mlogconfig/actions/workflows/github-code-scanning/codeql/badge.svg?branch=main)](https://github.com/talltechy/mlogconfig/actions/workflows/github-code-scanning/codeql)

This module provides a configurable logging setup for Python applications. It supports logging to console, file, syslog (for Linux and macOS), and Windows Event Log. The user can enable or disable each logging method as needed.

## Features

- Logging to console, file, syslog, and Windows Event Log
- Enable or disable each logging method as needed
- Easy setup and configuration

## Requirements

- Python 3.9 or higher

For Windows Event Log support, the following packages are required:

- pywin32

Install the required packages by running:

```bash
pip install pywin32
```

## Usage

Here is a basic example of using MLogConfig to set up logging for your application:

```python
from mlogconfig import setup_logging
import logging

# Set up logging

setup_logging(
    log_file_path="logs/app.log",
    error_log_file_path="logs/app_error.log",
    console_logging=True,
    syslog_logging=True,
    windows_event_logging=True,
    log_level=logging.DEBUG,
)

# Use logging in your application

logging.info("This is an info log message.")
logging.error("This is an error log message.")
```

## Customization

To customize the logging configuration, modify the arguments passed to the `setup_logging` function. For example:

- `log_file_path`: Path to the log file
- `error_log_file_path`: Path to the error log file
- `console_logging`: Set to `True` to enable console logging, `False` otherwise
- `syslog_logging`: Set to `True` to enable syslog logging (Linux and macOS only), `False` otherwise
- `windows_event_logging`: Set to `True` to enable Windows Event Log logging, `False` otherwise
- `log_level`: Set the logging level (e.g., `logging.DEBUG`, `logging.INFO`, `logging.WARNING`, `logging.ERROR`, `logging.CRITICAL`)

## Contributing

Contributions are welcome! Please read the [contributing guidelines](https://github.com/talltechy/mlogconfig/blob/main/CONTRIBUTING.md) before submitting pull requests or opening issues.

## License

MLogConfig is licensed under the [MIT License](https://github.com/talltechy/mlogconfig/blob/main/LICENSE.md).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mlogconfig",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Matt",
    "author_email": "matt@mattwyen.me",
    "download_url": "https://files.pythonhosted.org/packages/5a/13/23c3e9a1c1a9d2b9313b681dd4af28620c940101849e60486f850d51ad02/mlogconfig-0.2.5.tar.gz",
    "platform": null,
    "description": "# [mlogconfig.py](mlogconfig.py)\n\n[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)\n[![PyPI](https://img.shields.io/pypi/v/mlogconfig?label=PyPI%20Package%20Version)](https://pypi.org/project/mlogconfig/)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/mlogconfig?color=blue)\n[![CodeQL](https://github.com/talltechy/mlogconfig/actions/workflows/github-code-scanning/codeql/badge.svg?branch=main)](https://github.com/talltechy/mlogconfig/actions/workflows/github-code-scanning/codeql)\n\nThis module provides a configurable logging setup for Python applications. It supports logging to console, file, syslog (for Linux and macOS), and Windows Event Log. The user can enable or disable each logging method as needed.\n\n## Features\n\n- Logging to console, file, syslog, and Windows Event Log\n- Enable or disable each logging method as needed\n- Easy setup and configuration\n\n## Requirements\n\n- Python 3.9 or higher\n\nFor Windows Event Log support, the following packages are required:\n\n- pywin32\n\nInstall the required packages by running:\n\n```bash\npip install pywin32\n```\n\n## Usage\n\nHere is a basic example of using MLogConfig to set up logging for your application:\n\n```python\nfrom mlogconfig import setup_logging\nimport logging\n\n# Set up logging\n\nsetup_logging(\n    log_file_path=\"logs/app.log\",\n    error_log_file_path=\"logs/app_error.log\",\n    console_logging=True,\n    syslog_logging=True,\n    windows_event_logging=True,\n    log_level=logging.DEBUG,\n)\n\n# Use logging in your application\n\nlogging.info(\"This is an info log message.\")\nlogging.error(\"This is an error log message.\")\n```\n\n## Customization\n\nTo customize the logging configuration, modify the arguments passed to the `setup_logging` function. For example:\n\n- `log_file_path`: Path to the log file\n- `error_log_file_path`: Path to the error log file\n- `console_logging`: Set to `True` to enable console logging, `False` otherwise\n- `syslog_logging`: Set to `True` to enable syslog logging (Linux and macOS only), `False` otherwise\n- `windows_event_logging`: Set to `True` to enable Windows Event Log logging, `False` otherwise\n- `log_level`: Set the logging level (e.g., `logging.DEBUG`, `logging.INFO`, `logging.WARNING`, `logging.ERROR`, `logging.CRITICAL`)\n\n## Contributing\n\nContributions are welcome! Please read the [contributing guidelines](https://github.com/talltechy/mlogconfig/blob/main/CONTRIBUTING.md) before submitting pull requests or opening issues.\n\n## License\n\nMLogConfig is licensed under the [MIT License](https://github.com/talltechy/mlogconfig/blob/main/LICENSE.md).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This module provides a configurable logging setup for Python applications. It supports logging to console, file, syslog (for Linux and macOS), and Windows Event Log. The user can enable or disable each logging method as needed.",
    "version": "0.2.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e185e98162a523c7b4d605b43ac3def69243f195db42baea1afad525d7f543b3",
                "md5": "418821ed78a29453a35a78ca545214f0",
                "sha256": "db398281f298f857a8f011511ff67298b8a60d1a7f950f364a1006bf3966f3cb"
            },
            "downloads": -1,
            "filename": "mlogconfig-0.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "418821ed78a29453a35a78ca545214f0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 4676,
            "upload_time": "2023-06-09T22:23:12",
            "upload_time_iso_8601": "2023-06-09T22:23:12.224177Z",
            "url": "https://files.pythonhosted.org/packages/e1/85/e98162a523c7b4d605b43ac3def69243f195db42baea1afad525d7f543b3/mlogconfig-0.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a1323c3e9a1c1a9d2b9313b681dd4af28620c940101849e60486f850d51ad02",
                "md5": "e60c0aff8b8878cf91d896783ac27fb2",
                "sha256": "24f3a887684d1a5bc6643f4b42bf4db7b56d3356df1565cbe8ec26e4f9050514"
            },
            "downloads": -1,
            "filename": "mlogconfig-0.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e60c0aff8b8878cf91d896783ac27fb2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 3692,
            "upload_time": "2023-06-09T22:23:13",
            "upload_time_iso_8601": "2023-06-09T22:23:13.791041Z",
            "url": "https://files.pythonhosted.org/packages/5a/13/23c3e9a1c1a9d2b9313b681dd4af28620c940101849e60486f850d51ad02/mlogconfig-0.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-09 22:23:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mlogconfig"
}
        
Elapsed time: 0.16499s