# nice_logging
Simple logging library that has colored and timestamped output by default. Can be used as a drop-in replacement.
## Installation
```pip install nice_logging```
(Or just grab the .py file)
## Usage
```python
import nice_logging
nice_logging.basicConfig(level=nice_logging.DEBUG)
logger = nice_logging.getLogger(__name__)
logger.info("Hello")
```
```
2023-07-23 11:27:33,571 [INFO ] [__main__] Hello
```
Or:
```python
import nice_logging as logging
```
## Structured Logging
nice_logging has support for rudimentary structured logging. If you use `getStructuredLogger` instead of `getLogger` (or instantiate a `StructuredLogger`), you will get a logger whose log functions take a single message, and any number of keyword arguments, which are aggregated in a single dict. The resulting `LogRecord` will have the attribute `structured` set to `True`, and `structured_data` to the dict.
Raw data
{
"_id": null,
"home_page": "https://github.com/aib/nice_logging",
"name": "nice-logging",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.2",
"maintainer_email": "",
"keywords": "logging,logger,colored,style",
"author": "Orhan \"aib\" Kavrakoglu",
"author_email": "aibok42@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ee/bd/3c4bf3ae40618a15b28cc5eda6879bea224eb399c02de9f99b7f36c8a5f7/nice_logging-1.1.1.tar.gz",
"platform": null,
"description": "# nice_logging\n\nSimple logging library that has colored and timestamped output by default. Can be used as a drop-in replacement.\n\n## Installation\n\n```pip install nice_logging```\n\n(Or just grab the .py file)\n\n## Usage\n\n```python\nimport nice_logging\nnice_logging.basicConfig(level=nice_logging.DEBUG)\nlogger = nice_logging.getLogger(__name__)\nlogger.info(\"Hello\")\n```\n```\n2023-07-23 11:27:33,571 [INFO ] [__main__] Hello\n```\n\nOr:\n\n```python\nimport nice_logging as logging\n```\n\n## Structured Logging\n\nnice_logging has support for rudimentary structured logging. If you use `getStructuredLogger` instead of `getLogger` (or instantiate a `StructuredLogger`), you will get a logger whose log functions take a single message, and any number of keyword arguments, which are aggregated in a single dict. The resulting `LogRecord` will have the attribute `structured` set to `True`, and `structured_data` to the dict.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple logging library with colored and timestamped output by default",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/aib/nice_logging"
},
"split_keywords": [
"logging",
"logger",
"colored",
"style"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "00fcea9ff63be1943cca44df7769dd9c752e238bf3132046c5b91e525119c40c",
"md5": "66db14a6a0ecdf67c70c58eda0644576",
"sha256": "beb487aadbb25db117fae90374add6f2645da2450a9e6376150c2e1a693e2952"
},
"downloads": -1,
"filename": "nice_logging-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "66db14a6a0ecdf67c70c58eda0644576",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.2",
"size": 4372,
"upload_time": "2024-03-12T17:39:48",
"upload_time_iso_8601": "2024-03-12T17:39:48.697099Z",
"url": "https://files.pythonhosted.org/packages/00/fc/ea9ff63be1943cca44df7769dd9c752e238bf3132046c5b91e525119c40c/nice_logging-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eebd3c4bf3ae40618a15b28cc5eda6879bea224eb399c02de9f99b7f36c8a5f7",
"md5": "7872299b4cb99904267d71ff30a36c60",
"sha256": "bfb2486f7838c705cb5ac43beabb74b34890e6a2844a4d9f1785cf97afecfea6"
},
"downloads": -1,
"filename": "nice_logging-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "7872299b4cb99904267d71ff30a36c60",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.2",
"size": 4829,
"upload_time": "2024-03-12T17:39:50",
"upload_time_iso_8601": "2024-03-12T17:39:50.413352Z",
"url": "https://files.pythonhosted.org/packages/ee/bd/3c4bf3ae40618a15b28cc5eda6879bea224eb399c02de9f99b7f36c8a5f7/nice_logging-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-12 17:39:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aib",
"github_project": "nice_logging",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "nice-logging"
}