fw-logging


Namefw-logging JSON
Version 1.5.0 PyPI version JSON
download
home_pagehttps://gitlab.com/flywheel-io/tools/lib/fw-logging
SummaryLogging helper library.
upload_time2024-11-11 13:07:19
maintainerNone
docs_urlNone
authorFlywheel
requires_python<4.0,>=3.9
licenseMIT
keywords flywheel helper logging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fw-logging

Logging helper library for standard `logging` configuration, JSON formatting,
and for tailing (non-)structured logs re-formatted and colorized for humans.

## Installation

```bash
pip install fw-logging
```

## Usage

### logformat

Use the CLI utility `logformat` to re-format (Flywheel) logs for humans:

```bash
# pipe json and/or text logs directly
kubectl logs my-pod | logformat
# OR pass a filename containing the same
kubectl logs my-pod > my-pod.log
logformat my-pod.log
# OR pass a rich text file (.rtf) of logs
logformat my-pod-log.rtf
```

### Library

Use the `fw_logging` module to set up python `logging` in 2 lines:

```python
import fw_logging
fw_logging.setup_logging()
```

The default configuration sets up logging at level `INFO` to `stdout`, formatted
as `text` with colorized levels and caller information.

To emit structured JSON logs in production just override the formatter using an
environment variable: `FW_LOG_FORMATTER=json`.

Table of main config options and the corresponding envvars:

| Envvar             | Default  | Alternative / Example   |
|:-------------------|:---------|:------------------------|
| `FW_LOG_LEVEL`     | `INFO`   | `DEBUG`                 |
| `FW_LOG_HANDLER`   | `stdout` | `stderr`                |
| `FW_LOG_FORMATTER` | `text`   | `json`                  |
| `FW_LOG_LOGGERS`   |          | `{"pika":"ERROR"}`      |
| `FW_LOG_FILTERS`   |          | `{"lgr":{"msg":"rgx"}}` |

## License

[![MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/flywheel-io/tools/lib/fw-logging",
    "name": "fw-logging",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "Flywheel, helper, logging",
    "author": "Flywheel",
    "author_email": "support@flywheel.io",
    "download_url": null,
    "platform": null,
    "description": "# fw-logging\n\nLogging helper library for standard `logging` configuration, JSON formatting,\nand for tailing (non-)structured logs re-formatted and colorized for humans.\n\n## Installation\n\n```bash\npip install fw-logging\n```\n\n## Usage\n\n### logformat\n\nUse the CLI utility `logformat` to re-format (Flywheel) logs for humans:\n\n```bash\n# pipe json and/or text logs directly\nkubectl logs my-pod | logformat\n# OR pass a filename containing the same\nkubectl logs my-pod > my-pod.log\nlogformat my-pod.log\n# OR pass a rich text file (.rtf) of logs\nlogformat my-pod-log.rtf\n```\n\n### Library\n\nUse the `fw_logging` module to set up python `logging` in 2 lines:\n\n```python\nimport fw_logging\nfw_logging.setup_logging()\n```\n\nThe default configuration sets up logging at level `INFO` to `stdout`, formatted\nas `text` with colorized levels and caller information.\n\nTo emit structured JSON logs in production just override the formatter using an\nenvironment variable: `FW_LOG_FORMATTER=json`.\n\nTable of main config options and the corresponding envvars:\n\n| Envvar             | Default  | Alternative / Example   |\n|:-------------------|:---------|:------------------------|\n| `FW_LOG_LEVEL`     | `INFO`   | `DEBUG`                 |\n| `FW_LOG_HANDLER`   | `stdout` | `stderr`                |\n| `FW_LOG_FORMATTER` | `text`   | `json`                  |\n| `FW_LOG_LOGGERS`   |          | `{\"pika\":\"ERROR\"}`      |\n| `FW_LOG_FILTERS`   |          | `{\"lgr\":{\"msg\":\"rgx\"}}` |\n\n## License\n\n[![MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Logging helper library.",
    "version": "1.5.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/flywheel-io/tools/lib/fw-logging",
        "Repository": "https://gitlab.com/flywheel-io/tools/lib/fw-logging"
    },
    "split_keywords": [
        "flywheel",
        " helper",
        " logging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41e516f632604a6fb7691f543d935228accd8362e42891d05b389a1a8134cc82",
                "md5": "7293cf007eca25539c0eda51cbd1acd7",
                "sha256": "2e75b7290156d68a7e9ee8f2fe9669c2809f1c5604d007e03d3125a4ffd3c1d9"
            },
            "downloads": -1,
            "filename": "fw_logging-1.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7293cf007eca25539c0eda51cbd1acd7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 9137,
            "upload_time": "2024-11-11T13:07:19",
            "upload_time_iso_8601": "2024-11-11T13:07:19.294658Z",
            "url": "https://files.pythonhosted.org/packages/41/e5/16f632604a6fb7691f543d935228accd8362e42891d05b389a1a8134cc82/fw_logging-1.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 13:07:19",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "flywheel-io",
    "gitlab_project": "tools",
    "lcname": "fw-logging"
}
        
Elapsed time: 0.48618s