Name | qa-colorlog JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | A colorized logging package for QA and testing workflows |
upload_time | 2025-09-07 09:15:53 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
logging
qa
testing
colors
console
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# QA ColorLog
A powerful and flexible logging package designed specifically for QA and testing workflows. Features colorized console output, configurable file logging, and seamless integration with test automation frameworks.
## Features
- **Colorized Console Output**: Automatic color coding for different log levels
- **Flexible Configuration**: Environment variable based configuration
- **File Logging Support**: Optional logging to files with automatic directory creation
- **Multiple Logger Instances**: Support for creating custom logger instances
- **Production Ready**: Comprehensive error handling and robust design
- **Zero Dependencies**: No external dependencies required
- **Python 3.8+ Support**: Compatible with modern Python versions
## Installation
```bash
pip install qa-colorlog
```
## Quick Start
```python
from logger import logger
logger.info("Application started successfully")
logger.warning("This is a warning message")
logger.error("An error occurred")
logger.debug("Debug information")
logger.critical("Critical system error")
```
## Advanced Usage
### Creating Custom Logger Instances
```python
from logger import QALogger
# Create a custom logger with specific configuration
api_logger = QALogger(
name="api_tests",
log_level="INFO",
log_to_file=True,
log_file_path="api_tests.log",
colorize_output=True
)
api_logger.info("API test started")
```
### Exception Logging
```python
from logger import logger
try:
result = 10 / 0
except ZeroDivisionError:
logger.exception("Division by zero error occurred")
```
### Dynamic Log Level Changes
```python
from logger import logger
logger.set_level("ERROR") # Only log ERROR and CRITICAL messages
logger.set_level("DEBUG") # Log all messages
```
## Configuration
All configuration is handled through environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| `LOGGER_LOG_LEVEL` | `DEBUG` | Minimum log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
| `LOGGER_LOG_TO_FILE` | `false` | Enable file logging |
| `LOGGER_LOG_FILE_PATH` | `execution.log` | Path for log file |
| `LOGGER_COLORIZE_OUTPUT` | `true` | Enable colorized console output |
| `LOGGER_DATE_FORMAT` | `%Y-%m-%d %H:%M:%S` | Date format for log timestamps |
| `LOGGER_FORMAT` | `%(asctime)s - %(levelname)s - %(message)s` | Log message format |
### Environment Variable Examples
```bash
# Set log level to INFO
export LOGGER_LOG_LEVEL=INFO
# Enable file logging
export LOGGER_LOG_TO_FILE=true
export LOGGER_LOG_FILE_PATH=/var/log/myapp.log
# Disable colors for CI/CD environments
export LOGGER_COLORIZE_OUTPUT=false
# Custom log format
export LOGGER_FORMAT="[%(levelname)s] %(name)s: %(message)s"
```
## Color Scheme
The logger uses the following color scheme:
- **DEBUG**: Light Grey
- **INFO**: Green
- **WARNING**: Yellow
- **ERROR**: Red
- **CRITICAL**: Magenta
## API Reference
### QALogger Class
#### Constructor
```python
QALogger(
name: str = "qa_logger",
log_level: Optional[str] = None,
log_to_file: Optional[bool] = None,
log_file_path: Optional[str] = None,
colorize_output: Optional[bool] = None
)
```
#### Methods
- `debug(message: str, *args, **kwargs)`: Log debug message
- `info(message: str, *args, **kwargs)`: Log info message
- `warning(message: str, *args, **kwargs)`: Log warning message
- `error(message: str, *args, **kwargs)`: Log error message
- `critical(message: str, *args, **kwargs)`: Log critical message
- `exception(message: str, *args, **kwargs)`: Log exception with traceback
- `set_level(level: Union[str, int])`: Change log level dynamically
#### Properties
- `name`: Logger name
- `level`: Current log level
### LogColor Enum
Available color constants for custom formatting:
```python
from logger import LogColor
print(f"{LogColor.RED.value}Error message{LogColor.RESET.value}")
```
## Examples
The package includes several example scripts:
- `examples/basic_usage.py`: Basic logging functionality
- `examples/color_demo.py`: Demonstration of color output
- `examples/custom_logger.py`: Custom logger instance creation
- `examples/file_logging.py`: File logging example
- `examples/test_automation.py`: Test automation logging example
- `examples/api_testing.py`: API testing logging example
## Testing
Run the test suite:
```bash
# Install development dependencies
pip install pytest pytest-cov
# Run tests
python -m pytest tests/ -v
# Run tests with coverage
python -m pytest tests/ --cov=logger --cov-report=html
```
## Development
### Setup Development Environment
```bash
git clone <repository-url>
cd qa-colorlog
pip install -e .
pip install pytest pytest-cov black flake8 mypy
```
### Code Quality
```bash
# Format code
black .
# Lint code
flake8 .
# Type checking
mypy .
```
## License
MIT License - see LICENSE file for details.
## Contributing
1. Fork the repository
2. Create a feature branch
3. Add tests for new functionality
4. Ensure all tests pass
5. Submit a pull request
## Changelog
### 1.0.0
- Initial release
- Colorized console logging
- File logging support
- Environment variable configuration
- Comprehensive test suite
Raw data
{
"_id": null,
"home_page": null,
"name": "qa-colorlog",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "logging, qa, testing, colors, console",
"author": null,
"author_email": "QA Tools <qa@example.com>",
"download_url": "https://files.pythonhosted.org/packages/14/27/15b85f69bc3c3f15885adc4ee2e3b3bb444aa3ea83a230748cfde788ed66/qa_colorlog-1.0.0.tar.gz",
"platform": null,
"description": "# QA ColorLog\n\nA powerful and flexible logging package designed specifically for QA and testing workflows. Features colorized console output, configurable file logging, and seamless integration with test automation frameworks.\n\n## Features\n\n- **Colorized Console Output**: Automatic color coding for different log levels\n- **Flexible Configuration**: Environment variable based configuration\n- **File Logging Support**: Optional logging to files with automatic directory creation\n- **Multiple Logger Instances**: Support for creating custom logger instances\n- **Production Ready**: Comprehensive error handling and robust design\n- **Zero Dependencies**: No external dependencies required\n- **Python 3.8+ Support**: Compatible with modern Python versions\n\n## Installation\n\n```bash\npip install qa-colorlog\n```\n\n## Quick Start\n\n```python\nfrom logger import logger\n\nlogger.info(\"Application started successfully\")\nlogger.warning(\"This is a warning message\")\nlogger.error(\"An error occurred\")\nlogger.debug(\"Debug information\")\nlogger.critical(\"Critical system error\")\n```\n\n## Advanced Usage\n\n### Creating Custom Logger Instances\n\n```python\nfrom logger import QALogger\n\n# Create a custom logger with specific configuration\napi_logger = QALogger(\n name=\"api_tests\",\n log_level=\"INFO\",\n log_to_file=True,\n log_file_path=\"api_tests.log\",\n colorize_output=True\n)\n\napi_logger.info(\"API test started\")\n```\n\n### Exception Logging\n\n```python\nfrom logger import logger\n\ntry:\n result = 10 / 0\nexcept ZeroDivisionError:\n logger.exception(\"Division by zero error occurred\")\n```\n\n### Dynamic Log Level Changes\n\n```python\nfrom logger import logger\n\nlogger.set_level(\"ERROR\") # Only log ERROR and CRITICAL messages\nlogger.set_level(\"DEBUG\") # Log all messages\n```\n\n## Configuration\n\nAll configuration is handled through environment variables:\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `LOGGER_LOG_LEVEL` | `DEBUG` | Minimum log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |\n| `LOGGER_LOG_TO_FILE` | `false` | Enable file logging |\n| `LOGGER_LOG_FILE_PATH` | `execution.log` | Path for log file |\n| `LOGGER_COLORIZE_OUTPUT` | `true` | Enable colorized console output |\n| `LOGGER_DATE_FORMAT` | `%Y-%m-%d %H:%M:%S` | Date format for log timestamps |\n| `LOGGER_FORMAT` | `%(asctime)s - %(levelname)s - %(message)s` | Log message format |\n\n### Environment Variable Examples\n\n```bash\n# Set log level to INFO\nexport LOGGER_LOG_LEVEL=INFO\n\n# Enable file logging\nexport LOGGER_LOG_TO_FILE=true\nexport LOGGER_LOG_FILE_PATH=/var/log/myapp.log\n\n# Disable colors for CI/CD environments\nexport LOGGER_COLORIZE_OUTPUT=false\n\n# Custom log format\nexport LOGGER_FORMAT=\"[%(levelname)s] %(name)s: %(message)s\"\n```\n\n## Color Scheme\n\nThe logger uses the following color scheme:\n\n- **DEBUG**: Light Grey\n- **INFO**: Green \n- **WARNING**: Yellow\n- **ERROR**: Red\n- **CRITICAL**: Magenta\n\n## API Reference\n\n### QALogger Class\n\n#### Constructor\n\n```python\nQALogger(\n name: str = \"qa_logger\",\n log_level: Optional[str] = None,\n log_to_file: Optional[bool] = None, \n log_file_path: Optional[str] = None,\n colorize_output: Optional[bool] = None\n)\n```\n\n#### Methods\n\n- `debug(message: str, *args, **kwargs)`: Log debug message\n- `info(message: str, *args, **kwargs)`: Log info message \n- `warning(message: str, *args, **kwargs)`: Log warning message\n- `error(message: str, *args, **kwargs)`: Log error message\n- `critical(message: str, *args, **kwargs)`: Log critical message\n- `exception(message: str, *args, **kwargs)`: Log exception with traceback\n- `set_level(level: Union[str, int])`: Change log level dynamically\n\n#### Properties\n\n- `name`: Logger name\n- `level`: Current log level\n\n### LogColor Enum\n\nAvailable color constants for custom formatting:\n\n```python\nfrom logger import LogColor\n\nprint(f\"{LogColor.RED.value}Error message{LogColor.RESET.value}\")\n```\n\n## Examples\n\nThe package includes several example scripts:\n\n- `examples/basic_usage.py`: Basic logging functionality\n- `examples/color_demo.py`: Demonstration of color output\n- `examples/custom_logger.py`: Custom logger instance creation\n- `examples/file_logging.py`: File logging example\n- `examples/test_automation.py`: Test automation logging example\n- `examples/api_testing.py`: API testing logging example\n\n## Testing\n\nRun the test suite:\n\n```bash\n# Install development dependencies\npip install pytest pytest-cov\n\n# Run tests\npython -m pytest tests/ -v\n\n# Run tests with coverage\npython -m pytest tests/ --cov=logger --cov-report=html\n```\n\n## Development\n\n### Setup Development Environment\n\n```bash\ngit clone <repository-url>\ncd qa-colorlog\npip install -e .\npip install pytest pytest-cov black flake8 mypy\n```\n\n### Code Quality\n\n```bash\n# Format code\nblack .\n\n# Lint code \nflake8 .\n\n# Type checking\nmypy .\n```\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass\n5. Submit a pull request\n\n## Changelog\n\n### 1.0.0\n- Initial release\n- Colorized console logging\n- File logging support\n- Environment variable configuration\n- Comprehensive test suite\n",
"bugtrack_url": null,
"license": null,
"summary": "A colorized logging package for QA and testing workflows",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/example/qa-colorlog",
"Issues": "https://github.com/example/qa-colorlog/issues",
"Repository": "https://github.com/example/qa-colorlog"
},
"split_keywords": [
"logging",
" qa",
" testing",
" colors",
" console"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "102d9b7c029722207ec08e007a06380584260ddebccaa527a77e65aa3f71ea51",
"md5": "1ab2ad168fbf879acc6c6b229af22b55",
"sha256": "40296980ec3a0a77fde6264d9ec628add8500f85f15c0700864e4738bf694141"
},
"downloads": -1,
"filename": "qa_colorlog-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1ab2ad168fbf879acc6c6b229af22b55",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4274,
"upload_time": "2025-09-07T09:15:52",
"upload_time_iso_8601": "2025-09-07T09:15:52.205467Z",
"url": "https://files.pythonhosted.org/packages/10/2d/9b7c029722207ec08e007a06380584260ddebccaa527a77e65aa3f71ea51/qa_colorlog-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "142715b85f69bc3c3f15885adc4ee2e3b3bb444aa3ea83a230748cfde788ed66",
"md5": "cbd52291651b2cd6c94ead7ad8e86954",
"sha256": "d5e3d8936370c58357fc073cec6204bdb6b8d5d0606c66b0dcf74769914f3978"
},
"downloads": -1,
"filename": "qa_colorlog-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "cbd52291651b2cd6c94ead7ad8e86954",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8093,
"upload_time": "2025-09-07T09:15:53",
"upload_time_iso_8601": "2025-09-07T09:15:53.634398Z",
"url": "https://files.pythonhosted.org/packages/14/27/15b85f69bc3c3f15885adc4ee2e3b3bb444aa3ea83a230748cfde788ed66/qa_colorlog-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-07 09:15:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "example",
"github_project": "qa-colorlog",
"github_not_found": true,
"lcname": "qa-colorlog"
}