# 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')
```
**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.
### 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-hypixeloffical",
"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/48/b8/3643440083b41cee991e2eabaee153473339b69dc7f9ef9db5b4be3bbf2e/logged_hypixeloffical-0.2.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')\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### 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.2",
"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": "8527c5a9c965f315b494d84925413f5f9d70142e33e0cba031daa0b6c7547666",
"md5": "0ea7a56d5e980d2995e5938a3a466884",
"sha256": "32379b139dec6760d997108fe73ad386320be757a445722442c341f5b07b9c1f"
},
"downloads": -1,
"filename": "logged_hypixeloffical-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0ea7a56d5e980d2995e5938a3a466884",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3127,
"upload_time": "2024-08-09T15:37:00",
"upload_time_iso_8601": "2024-08-09T15:37:00.166401Z",
"url": "https://files.pythonhosted.org/packages/85/27/c5a9c965f315b494d84925413f5f9d70142e33e0cba031daa0b6c7547666/logged_hypixeloffical-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "48b83643440083b41cee991e2eabaee153473339b69dc7f9ef9db5b4be3bbf2e",
"md5": "aa32e697a0f6fd6ab54ee8c8d2a08792",
"sha256": "f8b1bdc20e35f5d3852e5a40311470ed80cc3ba1da09d5dde7defb149f9e439e"
},
"downloads": -1,
"filename": "logged_hypixeloffical-0.2.tar.gz",
"has_sig": false,
"md5_digest": "aa32e697a0f6fd6ab54ee8c8d2a08792",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3224,
"upload_time": "2024-08-09T15:37:01",
"upload_time_iso_8601": "2024-08-09T15:37:01.357280Z",
"url": "https://files.pythonhosted.org/packages/48/b8/3643440083b41cee991e2eabaee153473339b69dc7f9ef9db5b4be3bbf2e/logged_hypixeloffical-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-09 15:37:01",
"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-hypixeloffical"
}