Name | smpl-logger JSON |
Version |
0.1.5
JSON |
| download |
home_page | None |
Summary | A simple logging library with colored output and file rotation support |
upload_time | 2025-08-11 11:21:56 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.6 |
license | None |
keywords |
logging
logger
colored
rotation
python
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# SiMPLe Logger
A simple logging library with colored output and file rotation support
## Installation
```bash
pip install smpl-logger
```
Or install from source:
```bash
pip install git+https://github.com/greengoblinalex/simple-logger.git
```
## Usage
```python
from smpl_logger import get_logger
# It is recommended to use __name__ as the logger name —
# this is convenient for structuring logs in large projects
logger = get_logger(__name__)
# You can also explicitly pass a string, for example:
# logger = get_logger("my_app")
logger.info("This is an info message")
logger.error("This is an error message")
# Logging to file and console
file_logger = get_logger(__name__, log_file="app.log")
file_logger.info("This message will appear in both file and console")
```
## Configuration
You can configure the logger using additional parameters:
```python
logger = get_logger(
name=__name__, # Recommended to use __name__, but you can use a string
log_file="app.log",
level="DEBUG", # Logging level
rotation_size=5 * 1024 * 1024, # 5 MB for rotation
backup_count=3 # Keep 3 backup files
)
```
## Configuration via .env file
You can also configure logging parameters via a `.env` file in your project root:
```
LOG_DIR=logs # Directory for log files
LOG_LEVEL=INFO # Logging level
LOG_ROTATION_SIZE=5242880 # File size for rotation (5MB)
LOG_BACKUP_COUNT=3 # Number of backup files
```
## Features
- 🎨 **Colored output** - different log levels are highlighted with different colors
- 🔄 **File rotation** - automatic log rotation when the file reaches the maximum size
- ⚙️ **Flexible configuration** - configure via function parameters or environment variables
- 📦 **Lightweight** - no external dependencies, uses only the Python standard library
- 🔧 **Easy to use** - minimal code to get started
## Example of colored output
When using console logging, you will see:
- 🟢 **INFO** - green for informational messages
- 🟡 **WARNING** - yellow for warnings
- 🔴 **ERROR** - red for errors
- 🔵 **DEBUG** - cyan for debug information
- 🟥 **CRITICAL** - red background for critical errors
Raw data
{
"_id": null,
"home_page": null,
"name": "smpl-logger",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "logging, logger, colored, rotation, python",
"author": null,
"author_email": "greengoblinalex <greengoblinalex@mail.ru>",
"download_url": "https://files.pythonhosted.org/packages/fb/dc/2d4154be5b0bd7d7d5de9075b7984f1d2139871e25655132712340e9920a/smpl_logger-0.1.5.tar.gz",
"platform": null,
"description": "# SiMPLe Logger\r\n\r\nA simple logging library with colored output and file rotation support\r\n\r\n## Installation\r\n\r\n```bash\r\npip install smpl-logger\r\n```\r\n\r\nOr install from source:\r\n\r\n```bash\r\npip install git+https://github.com/greengoblinalex/simple-logger.git\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom smpl_logger import get_logger\r\n\r\n# It is recommended to use __name__ as the logger name \u2014\r\n# this is convenient for structuring logs in large projects\r\nlogger = get_logger(__name__)\r\n\r\n# You can also explicitly pass a string, for example:\r\n# logger = get_logger(\"my_app\")\r\nlogger.info(\"This is an info message\")\r\nlogger.error(\"This is an error message\")\r\n\r\n# Logging to file and console\r\nfile_logger = get_logger(__name__, log_file=\"app.log\")\r\nfile_logger.info(\"This message will appear in both file and console\")\r\n```\r\n\r\n## Configuration\r\n\r\nYou can configure the logger using additional parameters:\r\n\r\n```python\r\nlogger = get_logger(\r\n name=__name__, # Recommended to use __name__, but you can use a string\r\n log_file=\"app.log\",\r\n level=\"DEBUG\", # Logging level\r\n rotation_size=5 * 1024 * 1024, # 5 MB for rotation\r\n backup_count=3 # Keep 3 backup files\r\n)\r\n```\r\n\r\n## Configuration via .env file\r\n\r\nYou can also configure logging parameters via a `.env` file in your project root:\r\n\r\n```\r\nLOG_DIR=logs # Directory for log files\r\nLOG_LEVEL=INFO # Logging level\r\nLOG_ROTATION_SIZE=5242880 # File size for rotation (5MB)\r\nLOG_BACKUP_COUNT=3 # Number of backup files\r\n```\r\n\r\n## Features\r\n\r\n- \ud83c\udfa8 **Colored output** - different log levels are highlighted with different colors\r\n- \ud83d\udd04 **File rotation** - automatic log rotation when the file reaches the maximum size\r\n- \u2699\ufe0f **Flexible configuration** - configure via function parameters or environment variables\r\n- \ud83d\udce6 **Lightweight** - no external dependencies, uses only the Python standard library\r\n- \ud83d\udd27 **Easy to use** - minimal code to get started\r\n\r\n## Example of colored output\r\n\r\nWhen using console logging, you will see:\r\n- \ud83d\udfe2 **INFO** - green for informational messages\r\n- \ud83d\udfe1 **WARNING** - yellow for warnings\r\n- \ud83d\udd34 **ERROR** - red for errors\r\n- \ud83d\udd35 **DEBUG** - cyan for debug information\r\n- \ud83d\udfe5 **CRITICAL** - red background for critical errors\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple logging library with colored output and file rotation support",
"version": "0.1.5",
"project_urls": {
"Bug Tracker": "https://github.com/greengoblinalex/simple-logger/issues",
"Documentation": "https://github.com/greengoblinalex/simple-logger#readme",
"Homepage": "https://github.com/greengoblinalex/simple-logger",
"Source Code": "https://github.com/greengoblinalex/simple-logger"
},
"split_keywords": [
"logging",
" logger",
" colored",
" rotation",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8701b4805c7144b693ca7b4b91bbda47f88e7a5a65e2f071abd2988bb8a51630",
"md5": "998a94483c2951b42609cd31bac86fc4",
"sha256": "1792e9b974ac024c7f53da3c202b0a4783fac7785c716c057943fcd64d63053b"
},
"downloads": -1,
"filename": "smpl_logger-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "998a94483c2951b42609cd31bac86fc4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5150,
"upload_time": "2025-08-11T11:21:54",
"upload_time_iso_8601": "2025-08-11T11:21:54.720819Z",
"url": "https://files.pythonhosted.org/packages/87/01/b4805c7144b693ca7b4b91bbda47f88e7a5a65e2f071abd2988bb8a51630/smpl_logger-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fbdc2d4154be5b0bd7d7d5de9075b7984f1d2139871e25655132712340e9920a",
"md5": "6ad3d9b3db0ee3ef877d6f0712a88161",
"sha256": "eeed9fb0939243fb2166b7d213db62ce1680960e72bfbe622cf3fef35f431367"
},
"downloads": -1,
"filename": "smpl_logger-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "6ad3d9b3db0ee3ef877d6f0712a88161",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4877,
"upload_time": "2025-08-11T11:21:56",
"upload_time_iso_8601": "2025-08-11T11:21:56.534254Z",
"url": "https://files.pythonhosted.org/packages/fb/dc/2d4154be5b0bd7d7d5de9075b7984f1d2139871e25655132712340e9920a/smpl_logger-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-11 11:21:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "greengoblinalex",
"github_project": "simple-logger",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smpl-logger"
}