## Easily configure Python loggers
### Install
`pip install ready_logger`
### Usage
There is one function: `get_logger`
```py
from ready_logger import get_logger
```
#### Signature
```py
def get_logger(
name: Optional[str] = None,
level: Optional[Union[str, int]] = None,
show_file_path: Optional[bool] = None,
file_dir: Optional[Union[str, Path]] = None,
max_bytes: Optional[int] = 20_000_000,
backup_count: Optional[int] = 2,
) -> Logger:
"""Create a new logger or return an existing logger with the given name.
All arguments besides for `name` can be set via environment variables in the form `{LOGGER NAME}_{VARIABLE NAME}` or `READY_LOGGER_{VARIABLE NAME}`.
Variables including logger name will be chosen before `READY_LOGGER_` variables. Variables can be uppercase or lowercase.
Args:
name (Optional[str], optional): Name for the logger. Defaults to None.
level (Optional[Union[str, int]], optional): Logging level -- CRITICAL: 50, ERROR: 40, WARNING: 30, INFO: 20, DEBUG: 10.
show_file_path (Optional[bool], optional): Show absolute file path in log string prefix rather than just filename. Defaults to True if level is DEBUG, else False.
file_dir (Optional[Union[str, Path]], optional): Directory where log files should be written.
max_bytes (int): Max number of bytes to store in one log file.
backup_count (int): Number of log rotations to keep.
Returns:
Logger: The configured logger.
"""
```
Raw data
{
"_id": null,
"home_page": "https://github.com/djkelleher/ready-logger",
"name": "ready-logger",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "logs,logger,loggers,logging",
"author": "Dan Kelleher",
"author_email": "kelleherjdan@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/21/55/e01638828a89751cd65cbd00c7b42a41f1f3bd4958ace1da4251b64b0fd3/ready_logger-1.0.0.tar.gz",
"platform": null,
"description": "## Easily configure Python loggers\n\n### Install\n`pip install ready_logger`\n\n\n### Usage\nThere is one function: `get_logger`\n```py\nfrom ready_logger import get_logger\n```\n\n#### Signature\n```py\ndef get_logger(\n name: Optional[str] = None,\n level: Optional[Union[str, int]] = None,\n show_file_path: Optional[bool] = None,\n file_dir: Optional[Union[str, Path]] = None,\n max_bytes: Optional[int] = 20_000_000,\n backup_count: Optional[int] = 2,\n) -> Logger:\n \"\"\"Create a new logger or return an existing logger with the given name.\n\n All arguments besides for `name` can be set via environment variables in the form `{LOGGER NAME}_{VARIABLE NAME}` or `READY_LOGGER_{VARIABLE NAME}`.\n Variables including logger name will be chosen before `READY_LOGGER_` variables. Variables can be uppercase or lowercase.\n\n Args:\n name (Optional[str], optional): Name for the logger. Defaults to None.\n level (Optional[Union[str, int]], optional): Logging level -- CRITICAL: 50, ERROR: 40, WARNING: 30, INFO: 20, DEBUG: 10.\n show_file_path (Optional[bool], optional): Show absolute file path in log string prefix rather than just filename. Defaults to True if level is DEBUG, else False.\n file_dir (Optional[Union[str, Path]], optional): Directory where log files should be written.\n max_bytes (int): Max number of bytes to store in one log file.\n backup_count (int): Number of log rotations to keep.\n\n Returns:\n Logger: The configured logger.\n \"\"\"\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easily configure Python loggers.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/djkelleher/ready-logger",
"Repository": "https://github.com/djkelleher/ready-logger"
},
"split_keywords": [
"logs",
"logger",
"loggers",
"logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "91805215b77cc8e31d723108af64e2f4895bb8471200a2b37159f6ab47ad41f6",
"md5": "876252f1d9e7a7a1b1fdbc3580aeceb4",
"sha256": "60a1963e6c7918449290f5312ce0297c0ce26c90cc77832688324fe0f4d49eed"
},
"downloads": -1,
"filename": "ready_logger-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "876252f1d9e7a7a1b1fdbc3580aeceb4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3537,
"upload_time": "2023-06-15T15:25:44",
"upload_time_iso_8601": "2023-06-15T15:25:44.301579Z",
"url": "https://files.pythonhosted.org/packages/91/80/5215b77cc8e31d723108af64e2f4895bb8471200a2b37159f6ab47ad41f6/ready_logger-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2155e01638828a89751cd65cbd00c7b42a41f1f3bd4958ace1da4251b64b0fd3",
"md5": "549d67fa0bfe9b85a1710084fac589ed",
"sha256": "8b12476d42a7700b83f4b21359b8c9d3fd09721eb15930757fffb7c701d5fa91"
},
"downloads": -1,
"filename": "ready_logger-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "549d67fa0bfe9b85a1710084fac589ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 2916,
"upload_time": "2023-06-15T15:25:45",
"upload_time_iso_8601": "2023-06-15T15:25:45.344714Z",
"url": "https://files.pythonhosted.org/packages/21/55/e01638828a89751cd65cbd00c7b42a41f1f3bd4958ace1da4251b64b0fd3/ready_logger-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-15 15:25:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "djkelleher",
"github_project": "ready-logger",
"github_not_found": true,
"lcname": "ready-logger"
}