miskibin


Namemiskibin JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/michalskibinski109/miskibin
SummaryMy personal package for colored logs. Highly customizable.
upload_time2023-06-06 12:40:06
maintainer
docs_urlNone
authorMichał Skibiński
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
![example workflow](https://github.com/michalskibinski109/miskibin/actions/workflows/python-app.yml/badge.svg)
[![PyPI version](https://badge.fury.io/py/miskibin.svg)](https://badge.fury.io/py/miskibin)

# miskibin

this repo contains some of my scripts and tools, that i
could not find anywhere else.

## repository
https://github.com/michalskibinski109/miskibin

## description

module contains some useful functions, that i use in my projects.

## usage

### get_logger

returns highly configurable logger object.

- Every level has its own color. (If it is printed to terminal)
- Problems with logging messages from `ipynb` cells are resolved.
- Includes validation for file name and path.
- Has `disable_existing_loggers` param to disable all other loggers.
#### params:
- `logger_name` - name of the logger
- `lvl`: [logging level](https://docs.python.org/3/library/logging.html#logging-levels). Default is 10 (DEBUG).
- `file_name`: file that logs will be saved to. If None, logs will not be saved to file.
- `format`: [logging format](https://docs.python.org/3/library/logging.html#logrecord-attributes).
- `datefmt`: date format for logging formatter. Define only if `(asctime)` in format Default is "%H:%M:%S".
- `disable_existing_loggers`: if True, disable existing loggers.

#### Example 1:

```python
from miskibin.utils import get_logger
logger = get_logger(lvl = 10)
logger.debug("debug")
logger.info("info")
logger.warning("warning")
logger.error("error")
logger.critical("critical")
```

#### output:
<img src="https://user-images.githubusercontent.com/77834536/201940080-28e7dc08-ac99-4f8d-8f24-a9e0c6ac06c2.png" width="500"/>

#### example 2:

```python
from miskibin.utils import get_logger
logger = get_logger(
    datefmt="%Y-%m-%d %H:%M:%S",
    format="%(asctime)s %(levelname)s %(funcName)s %(message)s",
    disable_existing_loggers=True,
    logger_name="test2",
    file_name = None,
    lvl="INFO",
)


def example_func():
    logger.debug("debug")
    logger.info("info")
    logger.warning("warning")
    logger.error("error")
    logger.critical("critical")
example_func()
```

#### output:

<img src="https://user-images.githubusercontent.com/77834536/201939466-228b110f-21de-4461-9c86-55f8f46652ef.png" width="500"/>


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/michalskibinski109/miskibin",
    "name": "miskibin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Micha\u0142 Skibi\u0144ski",
    "author_email": "mskibinski109@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d5/5b/d8535b666a686257ecfc995a1c04d44d816d463457b889132b360f1c2e65/miskibin-1.2.4.tar.gz",
    "platform": null,
    "description": "\n![example workflow](https://github.com/michalskibinski109/miskibin/actions/workflows/python-app.yml/badge.svg)\n[![PyPI version](https://badge.fury.io/py/miskibin.svg)](https://badge.fury.io/py/miskibin)\n\n# miskibin\n\nthis repo contains some of my scripts and tools, that i\ncould not find anywhere else.\n\n## repository\nhttps://github.com/michalskibinski109/miskibin\n\n## description\n\nmodule contains some useful functions, that i use in my projects.\n\n## usage\n\n### get_logger\n\nreturns highly configurable logger object.\n\n- Every level has its own color. (If it is printed to terminal)\n- Problems with logging messages from `ipynb` cells are resolved.\n- Includes validation for file name and path.\n- Has `disable_existing_loggers` param to disable all other loggers.\n#### params:\n- `logger_name` - name of the logger\n- `lvl`: [logging level](https://docs.python.org/3/library/logging.html#logging-levels). Default is 10 (DEBUG).\n- `file_name`: file that logs will be saved to. If None, logs will not be saved to file.\n- `format`: [logging format](https://docs.python.org/3/library/logging.html#logrecord-attributes).\n- `datefmt`: date format for logging formatter. Define only if `(asctime)` in format Default is \"%H:%M:%S\".\n- `disable_existing_loggers`: if True, disable existing loggers.\n\n#### Example 1:\n\n```python\nfrom miskibin.utils import get_logger\nlogger = get_logger(lvl = 10)\nlogger.debug(\"debug\")\nlogger.info(\"info\")\nlogger.warning(\"warning\")\nlogger.error(\"error\")\nlogger.critical(\"critical\")\n```\n\n#### output:\n<img src=\"https://user-images.githubusercontent.com/77834536/201940080-28e7dc08-ac99-4f8d-8f24-a9e0c6ac06c2.png\" width=\"500\"/>\n\n#### example 2:\n\n```python\nfrom miskibin.utils import get_logger\nlogger = get_logger(\n    datefmt=\"%Y-%m-%d %H:%M:%S\",\n    format=\"%(asctime)s %(levelname)s %(funcName)s %(message)s\",\n    disable_existing_loggers=True,\n    logger_name=\"test2\",\n    file_name = None,\n    lvl=\"INFO\",\n)\n\n\ndef example_func():\n    logger.debug(\"debug\")\n    logger.info(\"info\")\n    logger.warning(\"warning\")\n    logger.error(\"error\")\n    logger.critical(\"critical\")\nexample_func()\n```\n\n#### output:\n\n<img src=\"https://user-images.githubusercontent.com/77834536/201939466-228b110f-21de-4461-9c86-55f8f46652ef.png\" width=\"500\"/>\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "My personal package for colored logs. Highly customizable.",
    "version": "1.2.4",
    "project_urls": {
        "Homepage": "https://github.com/michalskibinski109/miskibin"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72c3dcd5786e3a97f0c5a70574302144283579c94a73c6f56255020888181afc",
                "md5": "3daed78fb25c616f50f534f479cd2b2c",
                "sha256": "0e764a700941ec8814b428a9c07abad6c1b5fef01b4b0e2899bf5b1fe8e44396"
            },
            "downloads": -1,
            "filename": "miskibin-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3daed78fb25c616f50f534f479cd2b2c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4250,
            "upload_time": "2023-06-06T12:40:05",
            "upload_time_iso_8601": "2023-06-06T12:40:05.060810Z",
            "url": "https://files.pythonhosted.org/packages/72/c3/dcd5786e3a97f0c5a70574302144283579c94a73c6f56255020888181afc/miskibin-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d55bd8535b666a686257ecfc995a1c04d44d816d463457b889132b360f1c2e65",
                "md5": "132ac0de762f03d7365e8dc2796f1472",
                "sha256": "a6b7cdb4639be2cb4ab8bb4dcd0eec54b9017cc8decc67f77432fb621de381cb"
            },
            "downloads": -1,
            "filename": "miskibin-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "132ac0de762f03d7365e8dc2796f1472",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3574,
            "upload_time": "2023-06-06T12:40:06",
            "upload_time_iso_8601": "2023-06-06T12:40:06.340466Z",
            "url": "https://files.pythonhosted.org/packages/d5/5b/d8535b666a686257ecfc995a1c04d44d816d463457b889132b360f1c2e65/miskibin-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-06 12:40:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "michalskibinski109",
    "github_project": "miskibin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "miskibin"
}
        
Elapsed time: 0.19685s