# HLogger
![PyPI - Version](https://img.shields.io/pypi/v/hlogger)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sChameleoNz/hlogger/test.yml)
![Codecov](https://img.shields.io/codecov/c/github/sChameleoNz/hlogger)
HLogger is a utility module that provides a flexible logging solution for Python applications.
It allows you to easily create and manage loggers with both file and stream handlers.
## Installation
You can install HLogger using pip:
> $ pip install hlogger
## Usage
### Create Logger
```python
from hlogger import create_logger
# Create a logger
logger = create_logger("app_logger", "app_log.log")
# Log messages
logger.info("Application started")
```
### Create Logger with Specified Level
```python
import logging
from hlogger import create_logger
# Create a logger
logger = create_logger("app_logger", "app_log.log", level=logging.WARNING)
# Log messages
logger.warning("WARNING: No module named 'missing_module'")
```
### Get Logger
```python
from hlogger import create_logger, get_logger
# Create a logger
logger = create_logger("app_logger", "app_log.log")
# Create another logger
logger = create_logger("app_logger2", "app_log2.log")
# Set logger to the previous one and log messages to it
logger = get_logger("app_logger")
logger.error("Application error")
```
### Change Log File
```python
from hlogger import create_logger
# Create a logger
logger = create_logger("app_logger", "app_log.log")
# Log messages
logger.info("Application started")
# Change the log file dynamically
logger = create_logger("app_logger", "new_app_log.log")
# Log messages to the new log file
logger.warning("Application warning")
```
### Change Formatter
```python
import logging
from hlogger import create_logger, set_formatter
# Create a logger
logger = create_logger("app_logger", "app_log.log")
# Change formatter
set_formatter("app_logger", logging.Formatter("%(message)s"))
# Log messages
logger.info("Application started")
```
Raw data
{
"_id": null,
"home_page": "",
"name": "hlogger",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "logging,logger",
"author": "",
"author_email": "llChameleoNll <chameleon2318@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/aa/4e/97b7c1f233ca48747d968e22d26067a03788d8fbf04212059b86de8fc26a/hlogger-1.3.1.tar.gz",
"platform": null,
"description": "# HLogger\n\n![PyPI - Version](https://img.shields.io/pypi/v/hlogger)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sChameleoNz/hlogger/test.yml)\n![Codecov](https://img.shields.io/codecov/c/github/sChameleoNz/hlogger)\n\nHLogger is a utility module that provides a flexible logging solution for Python applications.\nIt allows you to easily create and manage loggers with both file and stream handlers.\n\n## Installation\n\nYou can install HLogger using pip:\n\n> $ pip install hlogger\n\n## Usage\n\n### Create Logger\n\n```python\nfrom hlogger import create_logger\n\n# Create a logger\nlogger = create_logger(\"app_logger\", \"app_log.log\")\n\n# Log messages\nlogger.info(\"Application started\")\n```\n\n### Create Logger with Specified Level\n\n```python\nimport logging\nfrom hlogger import create_logger\n\n# Create a logger\nlogger = create_logger(\"app_logger\", \"app_log.log\", level=logging.WARNING)\n\n# Log messages\nlogger.warning(\"WARNING: No module named 'missing_module'\")\n```\n\n### Get Logger\n\n```python\nfrom hlogger import create_logger, get_logger\n\n# Create a logger\nlogger = create_logger(\"app_logger\", \"app_log.log\")\n\n# Create another logger\nlogger = create_logger(\"app_logger2\", \"app_log2.log\")\n\n# Set logger to the previous one and log messages to it\nlogger = get_logger(\"app_logger\")\nlogger.error(\"Application error\")\n```\n\n### Change Log File\n\n```python\nfrom hlogger import create_logger\n\n# Create a logger\nlogger = create_logger(\"app_logger\", \"app_log.log\")\n\n# Log messages\nlogger.info(\"Application started\")\n\n# Change the log file dynamically\nlogger = create_logger(\"app_logger\", \"new_app_log.log\")\n\n# Log messages to the new log file\nlogger.warning(\"Application warning\")\n```\n\n### Change Formatter\n\n```python\nimport logging\nfrom hlogger import create_logger, set_formatter\n\n# Create a logger\nlogger = create_logger(\"app_logger\", \"app_log.log\")\n\n# Change formatter\nset_formatter(\"app_logger\", logging.Formatter(\"%(message)s\"))\n\n# Log messages\nlogger.info(\"Application started\")\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "A logger utility for python application",
"version": "1.3.1",
"project_urls": {
"Buy me a coffee": "https://www.buymeacoffee.com/llhoyall",
"Issues": "https://github.com/sChameleoNz/hlogger/issues",
"Repository": "https://github.com/sChameleoNz/hlogger"
},
"split_keywords": [
"logging",
"logger"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7d4ca0e9fbf1855bfae97f71aabf1ce8654e4b5fd90237d4cba0abb56d7756f8",
"md5": "2a52b482f4a754127fef3ec5ceacc68b",
"sha256": "72d3dbf9b273f88f42c1b7acd8205861aabab45bb7fc06085dcef5ad7aaea6e0"
},
"downloads": -1,
"filename": "hlogger-1.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2a52b482f4a754127fef3ec5ceacc68b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4865,
"upload_time": "2024-03-12T14:54:39",
"upload_time_iso_8601": "2024-03-12T14:54:39.510191Z",
"url": "https://files.pythonhosted.org/packages/7d/4c/a0e9fbf1855bfae97f71aabf1ce8654e4b5fd90237d4cba0abb56d7756f8/hlogger-1.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aa4e97b7c1f233ca48747d968e22d26067a03788d8fbf04212059b86de8fc26a",
"md5": "810870899cce35cfed4080e4c276acfa",
"sha256": "f1b4de9d8d075649c679223f71445ae80ba4eea1c135bde736b840f51015f67e"
},
"downloads": -1,
"filename": "hlogger-1.3.1.tar.gz",
"has_sig": false,
"md5_digest": "810870899cce35cfed4080e4c276acfa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5307,
"upload_time": "2024-03-12T14:54:41",
"upload_time_iso_8601": "2024-03-12T14:54:41.215585Z",
"url": "https://files.pythonhosted.org/packages/aa/4e/97b7c1f233ca48747d968e22d26067a03788d8fbf04212059b86de8fc26a/hlogger-1.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-12 14:54:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sChameleoNz",
"github_project": "hlogger",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pylint",
"specs": []
},
{
"name": "black",
"specs": []
},
{
"name": "pytest",
"specs": []
},
{
"name": "build",
"specs": []
},
{
"name": "twine",
"specs": []
}
],
"lcname": "hlogger"
}