# Verbose Terminal ![PyPI - Version](https://img.shields.io/pypi/v/Verbose_Terminal) ![PyPI - Downloads](https://img.shields.io/pypi/dm/Verbose_Terminal) ![PyPI - License](https://img.shields.io/pypi/l/Verbose_Terminal)
## Description
Verbose Terminal is a Python library that provides a simple and easy-to-use interface for displaying stylish messages in the terminal. It includes predefined styles for log, debug, info, success, warning, error and critical messages, and also has support for logging.
## Requirements
- Python 3.10+
## Installation
You can install the package via pip:
```bash
pip install verbose-terminal
```
## Usage
Import the `console` class from the `verbose_terminal` module and use its methods to print styled messages. The following examples demonstrate how to use the library:
### Basic Usage
```python
from verbose_terminal import console
# Displaying messages with different styles
console.log("This is a plain message.")
console.debug("This is a debug message.")
console.info("Here is some information.")
console.success("Operation completed successfully!")
console.warning("This is a warning message.")
console.error("An error has occurred.")
console.critical("This is a critical message.")
```
## Verbose Flag
By default, the `verbose` flag is set to `True`. This means that the messages will be displayed on the terminal. To not display messages in the terminal, set the `verbose` flag to `False`.
```python
from verbose_terminal import console
# Displaying messages in the terminal
console.log("This message will be displayed.")
console.log("This message will not be displayed.", verbose=False)
```
## Logging
Verbose Terminal can also log all messages to a file, whether they are printed to the terminal or not.
### Enable Logging
To enable logging, use the `enable_logging` method and specify a log file:
```python
from verbose_terminal import console
# Enable logging to 'messages.log'
console.enable_logging('messages.log')
```
Note: Logging should be enabled only once during the application initialization. If you enable logging again in another section of your code, the last enabled logging configuration will take precedence, and messages will be logged to the new file specified in the latest `enable_logging` call.
```python
from verbose_terminal import console
# Enable logging to 'initial_log.log'
console.enable_logging('initial_log.log')
# Enable logging again to 'new_log.log', this will override the previous log file
console.enable_logging('new_log.log')
```
In this example, all subsequent log messages will be saved to 'new_log.log', not 'initial_log.log'. Ensure you enable logging only once to avoid such conflicts.
### Log flag level
By default, the `log_level` flag is set to `INFO`. Only messages will be recorded: info, success, warning, error and critical, if you want to add the debug and log messages you must pass the `LOG` flag
```python
from verbose_terminal import console
# Enable logging to 'messages.log'
console.enable_logging('messages.log', log_level='LOG')
```
### Disable Logging
To disable logging, use the `disable_logging` method:
```python
from verbose_terminal import console
# Disable logging
console.disable_logging()
```
### View Logs
To view the logs, use the `view_logs` method:
```python
from verbose_terminal import console
# View logs
print(console.view_logs())
```
### Clear Logs
To clear the logs, use the `clear_logs` method:
```python
from verbose_terminal import console
# Clear logs
console.clear_logs()
```
### Save Logs
To save the logs to a file, use the `save_logs` method:
```python
from verbose_terminal import console
# Save logs to 'logs.txt'
console.save_logs('logs.txt')
```
## Running Tests
To run the tests, run the following command:
```bash
pytest
```
This will execute the unit tests and display the styled messages in the terminal, allowing you to visually verify the output.
## Contributing
Contributions are welcome! If you'd like to contribute, please follow these steps:
1. Fork the repository.
2. Create a new branch for your feature or bugfix.
3. Commit your changes and push your branch to GitHub.
4. Submit a pull request.
Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details.
## Support
Feel free to explore the code and customize the styles as per your requirements. If you encounter any issues or have suggestions for improvements, please open an issue on GitHub.
## Changelog
Please see the [CHANGELOG.md](CHANGELOG.md) file for details on recent changes and releases.
## License
This project is licensed under the MIT License. See the [LICENSE](https://github.com/wipodev/Verbose_Terminal/blob/main/LICENSE) file for more details.
---
Raw data
{
"_id": null,
"home_page": "https://github.com/wipodev/Verbose_Terminal",
"name": "verbose-terminal",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "python, terminal, console, verbose, verbose terminal, verbose terminal, verbose terminal",
"author": "Wipodev",
"author_email": "ajwipo@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/da/78d932b1e1cea03799fdfe504933f798d5b28244b985564f363484552b34/verbose-terminal-1.0.1.tar.gz",
"platform": null,
"description": "# Verbose Terminal ![PyPI - Version](https://img.shields.io/pypi/v/Verbose_Terminal) ![PyPI - Downloads](https://img.shields.io/pypi/dm/Verbose_Terminal) ![PyPI - License](https://img.shields.io/pypi/l/Verbose_Terminal)\r\n\r\n## Description\r\n\r\nVerbose Terminal is a Python library that provides a simple and easy-to-use interface for displaying stylish messages in the terminal. It includes predefined styles for log, debug, info, success, warning, error and critical messages, and also has support for logging.\r\n\r\n## Requirements\r\n\r\n- Python 3.10+\r\n\r\n## Installation\r\n\r\nYou can install the package via pip:\r\n\r\n```bash\r\npip install verbose-terminal\r\n```\r\n\r\n## Usage\r\n\r\nImport the `console` class from the `verbose_terminal` module and use its methods to print styled messages. The following examples demonstrate how to use the library:\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Displaying messages with different styles\r\nconsole.log(\"This is a plain message.\")\r\nconsole.debug(\"This is a debug message.\")\r\nconsole.info(\"Here is some information.\")\r\nconsole.success(\"Operation completed successfully!\")\r\nconsole.warning(\"This is a warning message.\")\r\nconsole.error(\"An error has occurred.\")\r\nconsole.critical(\"This is a critical message.\")\r\n```\r\n\r\n## Verbose Flag\r\n\r\nBy default, the `verbose` flag is set to `True`. This means that the messages will be displayed on the terminal. To not display messages in the terminal, set the `verbose` flag to `False`.\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Displaying messages in the terminal\r\nconsole.log(\"This message will be displayed.\")\r\nconsole.log(\"This message will not be displayed.\", verbose=False)\r\n```\r\n\r\n## Logging\r\n\r\nVerbose Terminal can also log all messages to a file, whether they are printed to the terminal or not.\r\n\r\n### Enable Logging\r\n\r\nTo enable logging, use the `enable_logging` method and specify a log file:\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Enable logging to 'messages.log'\r\nconsole.enable_logging('messages.log')\r\n```\r\n\r\nNote: Logging should be enabled only once during the application initialization. If you enable logging again in another section of your code, the last enabled logging configuration will take precedence, and messages will be logged to the new file specified in the latest `enable_logging` call.\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Enable logging to 'initial_log.log'\r\nconsole.enable_logging('initial_log.log')\r\n\r\n# Enable logging again to 'new_log.log', this will override the previous log file\r\nconsole.enable_logging('new_log.log')\r\n```\r\n\r\nIn this example, all subsequent log messages will be saved to 'new_log.log', not 'initial_log.log'. Ensure you enable logging only once to avoid such conflicts.\r\n\r\n### Log flag level\r\n\r\nBy default, the `log_level` flag is set to `INFO`. Only messages will be recorded: info, success, warning, error and critical, if you want to add the debug and log messages you must pass the `LOG` flag\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Enable logging to 'messages.log'\r\nconsole.enable_logging('messages.log', log_level='LOG')\r\n```\r\n\r\n### Disable Logging\r\n\r\nTo disable logging, use the `disable_logging` method:\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Disable logging\r\nconsole.disable_logging()\r\n```\r\n\r\n### View Logs\r\n\r\nTo view the logs, use the `view_logs` method:\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# View logs\r\nprint(console.view_logs())\r\n```\r\n\r\n### Clear Logs\r\n\r\nTo clear the logs, use the `clear_logs` method:\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Clear logs\r\nconsole.clear_logs()\r\n```\r\n\r\n### Save Logs\r\n\r\nTo save the logs to a file, use the `save_logs` method:\r\n\r\n```python\r\nfrom verbose_terminal import console\r\n\r\n# Save logs to 'logs.txt'\r\nconsole.save_logs('logs.txt')\r\n```\r\n\r\n## Running Tests\r\n\r\nTo run the tests, run the following command:\r\n\r\n```bash\r\npytest\r\n```\r\n\r\nThis will execute the unit tests and display the styled messages in the terminal, allowing you to visually verify the output.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! If you'd like to contribute, please follow these steps:\r\n\r\n1. Fork the repository.\r\n2. Create a new branch for your feature or bugfix.\r\n3. Commit your changes and push your branch to GitHub.\r\n4. Submit a pull request.\r\n\r\nPlease see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details.\r\n\r\n## Support\r\n\r\nFeel free to explore the code and customize the styles as per your requirements. If you encounter any issues or have suggestions for improvements, please open an issue on GitHub.\r\n\r\n## Changelog\r\n\r\nPlease see the [CHANGELOG.md](CHANGELOG.md) file for details on recent changes and releases.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/wipodev/Verbose_Terminal/blob/main/LICENSE) file for more details.\r\n\r\n---\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for displaying messages in the terminal with styles and logging support.",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/wipodev/Verbose_Terminal/issues",
"Documentation": "https://github.com/wipodev/Verbose_Terminal/blob/main/README.md",
"Homepage": "https://github.com/wipodev/Verbose_Terminal",
"Source": "https://github.com/wipodev/Verbose_Terminal"
},
"split_keywords": [
"python",
" terminal",
" console",
" verbose",
" verbose terminal",
" verbose terminal",
" verbose terminal"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "acd2eb91095583c96f15bd0c2c34b1407d6ce2fe0e7d5d498e64b9943ad946eb",
"md5": "710743bfaf4a966f5c77029aa073bdae",
"sha256": "35a417d98bb5f032f69df6344bcb5cad386394c06ceaa67e7c5d749bbf9f6bc3"
},
"downloads": -1,
"filename": "verbose_terminal-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "710743bfaf4a966f5c77029aa073bdae",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5631,
"upload_time": "2024-05-30T00:12:12",
"upload_time_iso_8601": "2024-05-30T00:12:12.043998Z",
"url": "https://files.pythonhosted.org/packages/ac/d2/eb91095583c96f15bd0c2c34b1407d6ce2fe0e7d5d498e64b9943ad946eb/verbose_terminal-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0da78d932b1e1cea03799fdfe504933f798d5b28244b985564f363484552b34",
"md5": "3b2f0b4c071da03de0621b3c9d0f77fd",
"sha256": "3284c80c45bf0cc141aca79e60a4a8217b4139a913f694624e6a8468ad29bbe8"
},
"downloads": -1,
"filename": "verbose-terminal-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3b2f0b4c071da03de0621b3c9d0f77fd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5356,
"upload_time": "2024-05-30T00:12:13",
"upload_time_iso_8601": "2024-05-30T00:12:13.087678Z",
"url": "https://files.pythonhosted.org/packages/c0/da/78d932b1e1cea03799fdfe504933f798d5b28244b985564f363484552b34/verbose-terminal-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-30 00:12:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wipodev",
"github_project": "Verbose_Terminal",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "verbose-terminal"
}