yirgachefe


Nameyirgachefe JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/iconloop/Yirgachefe
SummaryConvenience of configuration and logging.
upload_time2023-06-09 02:55:15
maintainer
docs_urlNone
authorICONLOOP
requires_python>=3.7.5
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Yirgachefe
A library for the convenience of configuring environment variables, configuration files, and logger.

## Prerequisite
- Python 3.9.x or higher

## Quick start
The configuration file format is JSON, and the default location is [CWD]/configure.json.
* CWD: Current working directory (you can get it with 'os.getcwd()')

### Example configure.json
```json
{
  "API_PORT": 8100,
  "STORAGE_ID": "storage_1"
}
```

### Example Code
```python
from yirgachefe import config, logger

logger.debug(config['API_PORT'])
logger.info(config.API_PORT)

config['NEW'] = 'new value'
config.NEW2 = 'new value2'
```

## Custom Usage

### Default configure.json.
* This value is set internally and is used even if the file doesn't exist.
* You can use the changed value by explicitly setting it in the file.
```json
{
  "debug": true,
  "log_level": "DEBUG",
  "log_format": "%(asctime)s,%(msecs)03d %(process)d %(thread)d %(levelname)s %(filename)s(%(lineno)d) %(message)s",
  "log_path": "Yirgachefe.log",
  "log_when": "d",
  "log_interval": 1,
  "log_backup_count": 5
}
```
* debug: Set stream handler to logging with coloredlog.
* log_level: Log level for logging.
* log_format: Log format for logging.
* log_path: Write a file log if present (optional)

### Optional configuration for RotatingFileHandler.
* yirgachefe supports time-based log file rotating.
* Each option is as follows.
* Rotating works when all values are present.
```json
{
  "log_when": "d",
  "log_interval": 1,
  "log_backup_count": 10
}
```
* log_when: rotating unit s | m | h | d | w0-w6 (see. 'logging.handler')
* log_interval: rotating period
* log_backup_count: log backup count.

### Make and Save configure.json
* After creating an empty config class, you can set the config value and save it as a file.

```python
from yirgachefe import Config

config = Config()
config.NEW = 'new value'
config.write_config()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iconloop/Yirgachefe",
    "name": "yirgachefe",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.5",
    "maintainer_email": "",
    "keywords": "",
    "author": "ICONLOOP",
    "author_email": "t_core@iconloop.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/bb/42ae4f75ff8f0274d48b14d9b9df407389971b152a20575d422d88a211b1/yirgachefe-0.1.6.tar.gz",
    "platform": null,
    "description": "# Yirgachefe\nA library for the convenience of configuring environment variables, configuration files, and logger.\n\n## Prerequisite\n- Python 3.9.x or higher\n\n## Quick start\nThe configuration file format is JSON, and the default location is [CWD]/configure.json.\n* CWD: Current working directory (you can get it with 'os.getcwd()')\n\n### Example configure.json\n```json\n{\n  \"API_PORT\": 8100,\n  \"STORAGE_ID\": \"storage_1\"\n}\n```\n\n### Example Code\n```python\nfrom yirgachefe import config, logger\n\nlogger.debug(config['API_PORT'])\nlogger.info(config.API_PORT)\n\nconfig['NEW'] = 'new value'\nconfig.NEW2 = 'new value2'\n```\n\n## Custom Usage\n\n### Default configure.json.\n* This value is set internally and is used even if the file doesn't exist.\n* You can use the changed value by explicitly setting it in the file.\n```json\n{\n  \"debug\": true,\n  \"log_level\": \"DEBUG\",\n  \"log_format\": \"%(asctime)s,%(msecs)03d %(process)d %(thread)d %(levelname)s %(filename)s(%(lineno)d) %(message)s\",\n  \"log_path\": \"Yirgachefe.log\",\n  \"log_when\": \"d\",\n  \"log_interval\": 1,\n  \"log_backup_count\": 5\n}\n```\n* debug: Set stream handler to logging with coloredlog.\n* log_level: Log level for logging.\n* log_format: Log format for logging.\n* log_path: Write a file log if present (optional)\n\n### Optional configuration for RotatingFileHandler.\n* yirgachefe supports time-based log file rotating.\n* Each option is as follows.\n* Rotating works when all values are present.\n```json\n{\n  \"log_when\": \"d\",\n  \"log_interval\": 1,\n  \"log_backup_count\": 10\n}\n```\n* log_when: rotating unit s | m | h | d | w0-w6 (see. 'logging.handler')\n* log_interval: rotating period\n* log_backup_count: log backup count.\n\n### Make and Save configure.json\n* After creating an empty config class, you can set the config value and save it as a file.\n\n```python\nfrom yirgachefe import Config\n\nconfig = Config()\nconfig.NEW = 'new value'\nconfig.write_config()\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Convenience of configuration and logging.",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://github.com/iconloop/Yirgachefe"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf82f7d8a5f1cba1439a718fede99f7e0d2250940f558f2b0522846d3f5eb6df",
                "md5": "b48225a6be5921133d0bfd150a9e2039",
                "sha256": "679f5facd179f7afaf98719a67ce9db97e3682b34a2cbfd5e9f628130b936889"
            },
            "downloads": -1,
            "filename": "yirgachefe-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b48225a6be5921133d0bfd150a9e2039",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.5",
            "size": 11596,
            "upload_time": "2023-06-09T02:55:13",
            "upload_time_iso_8601": "2023-06-09T02:55:13.822309Z",
            "url": "https://files.pythonhosted.org/packages/bf/82/f7d8a5f1cba1439a718fede99f7e0d2250940f558f2b0522846d3f5eb6df/yirgachefe-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1bb42ae4f75ff8f0274d48b14d9b9df407389971b152a20575d422d88a211b1",
                "md5": "621df19a51bef4a9875f12d5982aa2bd",
                "sha256": "c6b121d6bd93ce1df44ec224d574029b1c054dcae13c0479546a93f9bf5e34fe"
            },
            "downloads": -1,
            "filename": "yirgachefe-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "621df19a51bef4a9875f12d5982aa2bd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.5",
            "size": 10885,
            "upload_time": "2023-06-09T02:55:15",
            "upload_time_iso_8601": "2023-06-09T02:55:15.723093Z",
            "url": "https://files.pythonhosted.org/packages/d1/bb/42ae4f75ff8f0274d48b14d9b9df407389971b152a20575d422d88a211b1/yirgachefe-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-09 02:55:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iconloop",
    "github_project": "Yirgachefe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "yirgachefe"
}
        
Elapsed time: 0.08177s