fw-logging


Namefw-logging JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://gitlab.com/flywheel-io/tools/lib/fw-logging
SummaryLogging helper library.
upload_time2024-05-17 05:37:16
maintainerNone
docs_urlNone
authorFlywheel
requires_python<4.0,>=3.8
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.8",
    "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.3.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": "81d7d51cfaf35d05784c6ad4fd87bf9669c5967ad01e2eda1126daccb0f223a6",
                "md5": "c6d30e8e7db96340019aa5303f211f36",
                "sha256": "52fa63005dea53398a1785f9d77491785e83255d293cb330dd07744c1916ea04"
            },
            "downloads": -1,
            "filename": "fw_logging-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c6d30e8e7db96340019aa5303f211f36",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 9137,
            "upload_time": "2024-05-17T05:37:16",
            "upload_time_iso_8601": "2024-05-17T05:37:16.941229Z",
            "url": "https://files.pythonhosted.org/packages/81/d7/d51cfaf35d05784c6ad4fd87bf9669c5967ad01e2eda1126daccb0f223a6/fw_logging-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-17 05:37:16",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "flywheel-io",
    "gitlab_project": "tools",
    "lcname": "fw-logging"
}
        
Elapsed time: 0.25936s