# Logged.py
A custom logging package with advanced features including color-coded console output, log rotation, and compression.
## Installation
To install the package you can run this command in your command prompt or powershell.
```bash
pip install logged
```
## Usage
### Importing the Package
```python
import logged
```
### Creating a Logger
Create a Logger instance with the desired output type and format.
```python
logger = logger.Logger(output_type='console', format='<bold><gray>/d</gray> <type>/t</type></bold> /m', utc=None)
```
**output_type:** Specify "console" for console output or "file" for file output.
**format:** Define the log message format using custom tags (e.g., /d for date, /t for type, /m for message).
**file:** If you chose output type as "file" this is a required parameter which must include the log file path.
**utc:** Adds this parameter to the UTC date. If left empty it will use local time.
### Logging Messages
You can use different methods to log messages at various levels:
```python
logger.trace("This is a trace message.")
logger.debug("This is a debug message.")
logger.info("This is an info message.")
logger.warn("This is a warning message.")
logger.error("This is an error message.")
logger.fatal("This is a fatal message.")
logger.all("This is a message for all levels.")
```
### Features
- **Customizable Formatting:** Use ANSI color codes and custom tags in log messages.
- **Log Rotation with Compression:** Automatically rotates log files and compresses old logs into ZIP archives.
- **Flexible Output Options:** Choose between console and file output.
### API Reference
<class>Logger
A class for logging messages.
#### Constructor:
**<str>output_type:** "console" or "file". Default is "console".
**<str>format:** Log message format. Default is "<bold><gray>/d</gray> <type>/t</type></bold> /m".
**<str?>file:** File path for file output.
#### Methods:
**<None>trace(message: str):** Logs a trace message.
**<None>debug(message: str):** Logs a debug message.
**<None>info(message: str):** Logs an info message.
**<None>warn(message: str):** Logs a warning message.
**<None>error(message: str):** Logs an error message.
**<None>fatal(message: str):** Logs a fatal message.
**<None>all(message: str):** Logs a message for all levels.
#### Example:
```python
import logger
# Initialize logger
logger = logger.Logger(output_type='file', format='<bold><gray>/d</gray> <type>/t</type></bold> /m', file='logfile.txt')
# Log messages
logger.info("This is an info message.")
logger.error("This is an error message.")
```
## License
This package is licensed under the MIT License. See the [LICENSE](https://github.com/hypixeloffical/logged-py/blob/main/LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/hypixeloffical/logged-py",
"name": "logged",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "hypixeloffical",
"author_email": "hypixeloffical <hypixel.offical.tr@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/bf/c8/e0c3a95549b502df3d2f5982c366aa6895539ae415a42d03113a7be413aa/logged-0.3.1.tar.gz",
"platform": null,
"description": "# Logged.py\r\nA custom logging package with advanced features including color-coded console output, log rotation, and compression.\r\n\r\n## Installation\r\nTo install the package you can run this command in your command prompt or powershell.\r\n\r\n```bash\r\npip install logged\r\n```\r\n\r\n## Usage\r\n### Importing the Package\r\n```python\r\nimport logged\r\n```\r\n\r\n### Creating a Logger\r\nCreate a Logger instance with the desired output type and format.\r\n\r\n```python\r\nlogger = logger.Logger(output_type='console', format='<bold><gray>/d</gray> <type>/t</type></bold> /m', utc=None)\r\n```\r\n**output_type:** Specify \"console\" for console output or \"file\" for file output.\r\n\r\n**format:** Define the log message format using custom tags (e.g., /d for date, /t for type, /m for message).\r\n\r\n**file:** If you chose output type as \"file\" this is a required parameter which must include the log file path.\r\n\r\n**utc:** Adds this parameter to the UTC date. If left empty it will use local time.\r\n\r\n### Logging Messages\r\nYou can use different methods to log messages at various levels:\r\n\r\n```python\r\nlogger.trace(\"This is a trace message.\")\r\nlogger.debug(\"This is a debug message.\")\r\nlogger.info(\"This is an info message.\")\r\nlogger.warn(\"This is a warning message.\")\r\nlogger.error(\"This is an error message.\")\r\nlogger.fatal(\"This is a fatal message.\")\r\nlogger.all(\"This is a message for all levels.\")\r\n```\r\n### Features\r\n- **Customizable Formatting:** Use ANSI color codes and custom tags in log messages.\r\n- **Log Rotation with Compression:** Automatically rotates log files and compresses old logs into ZIP archives.\r\n- **Flexible Output Options:** Choose between console and file output.\r\n\r\n### API Reference\r\n<class>Logger\r\nA class for logging messages.\r\n\r\n#### Constructor:\r\n\r\n**<str>output_type:** \"console\" or \"file\". Default is \"console\".\r\n**<str>format:** Log message format. Default is \"<bold><gray>/d</gray> <type>/t</type></bold> /m\".\r\n**<str?>file:** File path for file output.\r\n\r\n#### Methods:\r\n\r\n**<None>trace(message: str):** Logs a trace message.\r\n\r\n**<None>debug(message: str):** Logs a debug message.\r\n\r\n**<None>info(message: str):** Logs an info message.\r\n\r\n**<None>warn(message: str):** Logs a warning message.\r\n\r\n**<None>error(message: str):** Logs an error message.\r\n\r\n**<None>fatal(message: str):** Logs a fatal message.\r\n\r\n**<None>all(message: str):** Logs a message for all levels.\r\n\r\n\r\n#### Example:\r\n```python\r\nimport logger\r\n\r\n# Initialize logger\r\nlogger = logger.Logger(output_type='file', format='<bold><gray>/d</gray> <type>/t</type></bold> /m', file='logfile.txt')\r\n\r\n# Log messages\r\nlogger.info(\"This is an info message.\")\r\nlogger.error(\"This is an error message.\")\r\n```\r\n\r\n## License\r\n\r\nThis package is licensed under the MIT License. See the [LICENSE](https://github.com/hypixeloffical/logged-py/blob/main/LICENSE) file for details.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A custom logging package",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/hypixeloffical/logged-py",
"Issues": "https://github.com/hypixeloffical/logged-py/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f01afb4a7579e06de558eef68eb37f0840509dbcd70f3a856abec548848f14d7",
"md5": "9ad213c1d4a668194c4b5260b198d748",
"sha256": "92f12d710fb604d5a80040c930c9ce501bce6a4545159cc4dcf714332dbee767"
},
"downloads": -1,
"filename": "logged-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9ad213c1d4a668194c4b5260b198d748",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3029,
"upload_time": "2024-08-10T11:15:35",
"upload_time_iso_8601": "2024-08-10T11:15:35.523362Z",
"url": "https://files.pythonhosted.org/packages/f0/1a/fb4a7579e06de558eef68eb37f0840509dbcd70f3a856abec548848f14d7/logged-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bfc8e0c3a95549b502df3d2f5982c366aa6895539ae415a42d03113a7be413aa",
"md5": "9c0ce56d95b3cd673b39a0313464c898",
"sha256": "999913e5c47b123fba1fcb4d19dd55b9de3fd4a28bb9b0bfff0c1935c2016ed7"
},
"downloads": -1,
"filename": "logged-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "9c0ce56d95b3cd673b39a0313464c898",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3257,
"upload_time": "2024-08-10T11:15:37",
"upload_time_iso_8601": "2024-08-10T11:15:37.459636Z",
"url": "https://files.pythonhosted.org/packages/bf/c8/e0c3a95549b502df3d2f5982c366aa6895539ae415a42d03113a7be413aa/logged-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-10 11:15:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hypixeloffical",
"github_project": "logged-py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "logged"
}