goatl


Namegoatl JSON
Version 0.6.5 PyPI version JSON
download
home_pagehttps://github.com/EytanDn/goatl
SummaryThe goat logger
upload_time2023-05-08 11:32:02
maintainer
docs_urlNone
authorgoatl
requires_python>=3.8,<4.0
licenseMIT
keywords logging logger log goat goatl goatlogger goat-logger goat-logging goat-log
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
<img src="assets/images/goatlbanner.png" alt="goatl logo"/>

</div>

---

# goatl

<div align="center">

[![Build status](https://github.com/EytanDn/goatl/workflows/build/badge.svg?branch=master&event=push)](https://github.com/EytanDn/goatl/actions?query=workflow%3Abuild)
[![Python Version](https://img.shields.io/pypi/pyversions/goatl.svg)](https://pypi.org/project/goatl/)
[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/EytanDn/goatl/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![Coverage Report](assets/images/coverage.svg)

</div>

## Installation

```bash
pip install -U goatl
```

or install with `Poetry`

```bash
poetry add goatl
```

## Purpose

goatl provides a simple and easy to use logging interface for python projects.
by replacing repetitive boilerplate code with a simple function call:
the magic "log" function.

```python
from goatl import log
```

goatl usage is all about the log

## Usage

### as a function

```python
log("hello world")
# 2020-07-19 16:00:00,000 - goatl - INFO - hello world
log.debug("hello world?")
# 2020-07-19 16:00:00,000 - goatl - DEBUG - hello world?
log.info("do you know the answer of {} + {}?", 41, 1)
# 2020-07-19 16:00:00,000 - goatl - INFO - do you know the answer of 41 + 1?
```

### as a method decorator

```python
@log
def foo(x, y):
    return x + y

@log.debug
def bar():
    return "hello world"

@log.debug(return_level=log.info)
def baz(x):
    return x*2

foo(1, 2)
# ... INFO - foo called with args: (1, 2), kwargs: {}
# ... DEBUG - foo returned: 3
bar()
# ... DEBUG - bar called with args: (), kwargs: {}
# ... DEBUG - bar returned: hello world
baz(3)
# ... DEBUG - baz called with args: (3,), kwargs: {}
# ... INFO - baz returned: 6
```

### as a class decorator

```python
@log
class Foo:
    def __init__(self, x):
        self.x = x

    def bar(self, y):
        return self.x + y

    @log.warn
    def baz(self):
        return self.x * 2


foo = Foo(1)
# ... INFO - Instantiated Foo with args: (1,), kwargs: {}
foo.bar(2)
# ... INFO - Foo.bar called with args: (2,), kwargs: {}
# ... DEBUG - Foo.bar returned: 3
foo.baz()
# ... WARNING - Foo.baz called with args: (), kwargs: {}
# ... WARNING - Foo.baz returned: 2
```

### configurations shortcuts

```python
file_formatter = log.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
log.addFileHandler("foo.log", fmt=file_formatter)
log.addStreamHandler(fmt="%(levelname)s - %(message)s")
log.basicConfig(...)
```

### logging interface #not implemented yet

I do plan to implement goatl's interaction with logging through an interface
such that it will be possible to use goatl with any logging backend.

```python
log.setBackend(logging)
log.setBackend(loguru)
logger = log.getLogger("foo")
```

## core concepts

In order to justify the existence of goatl,
it must fulfill three important core concepts:

1. Unobtrusive - it should not interfere\* with the existing code.
2. Ease of use - using it should be intuitive and pythonic.
3. Clean - the amount of code added to the existing code should be minimal.

<sub>\* - logging will always carry a performative cost, goatl will aim at keeping it to a minimum.</sub>

### means

extensive testing of goatl must be implemented to ensure that it does not interfere with the existing code.
it should be tested by wrapping other popular libraries and modules with goatl.
this will ensure that goatl does not interfere with the existing code.
performance tests should be implemented to measure the performance cost of goatl,
it should not exceed a reasonable threshold, in comparison to adding logging manually.

### main features

the log function provides an easy interace for:

- out of and in context log calls
- wrapping existing functions with log calls
- wrapping existing classes with log calls
- wrapping existing modules with log calls #not implemented yet, is this even possible?
- logging configuration #not implemented yet
- support multiple logging backends #not implemented yet

all in an intuitive and pythonic way.

## Releases

You can see the list of available releases on the [GitHub Releases](https://github.com/EytanDn/goatl/releases) page.

## License

[![License](https://img.shields.io/github/license/Eytandn/goatl)](https://github.com/EytanDn/goatl/blob/master/LICENSE)

This project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/eytandn/goatl/blob/master/LICENSE) for more details.

## Citation

```bibtex
@misc{goatl,
  author = {goatl},
  title = {goat logger},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/EytanDn/goatl}}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EytanDn/goatl",
    "name": "goatl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "logging,logger,log,goat,goatl,goatlogger,goat-logger,goat-logging,goat-log",
    "author": "goatl",
    "author_email": "EytanDn@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9f/54/e5d9106ff6cb0d5a99aeebe4115e3b2bf18f1b03ae60080c64fb0c3f2cb4/goatl-0.6.5.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n<img src=\"assets/images/goatlbanner.png\" alt=\"goatl logo\"/>\n\n</div>\n\n---\n\n# goatl\n\n<div align=\"center\">\n\n[![Build status](https://github.com/EytanDn/goatl/workflows/build/badge.svg?branch=master&event=push)](https://github.com/EytanDn/goatl/actions?query=workflow%3Abuild)\n[![Python Version](https://img.shields.io/pypi/pyversions/goatl.svg)](https://pypi.org/project/goatl/)\n[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/EytanDn/goatl/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n![Coverage Report](assets/images/coverage.svg)\n\n</div>\n\n## Installation\n\n```bash\npip install -U goatl\n```\n\nor install with `Poetry`\n\n```bash\npoetry add goatl\n```\n\n## Purpose\n\ngoatl provides a simple and easy to use logging interface for python projects.\nby replacing repetitive boilerplate code with a simple function call:\nthe magic \"log\" function.\n\n```python\nfrom goatl import log\n```\n\ngoatl usage is all about the log\n\n## Usage\n\n### as a function\n\n```python\nlog(\"hello world\")\n# 2020-07-19 16:00:00,000 - goatl - INFO - hello world\nlog.debug(\"hello world?\")\n# 2020-07-19 16:00:00,000 - goatl - DEBUG - hello world?\nlog.info(\"do you know the answer of {} + {}?\", 41, 1)\n# 2020-07-19 16:00:00,000 - goatl - INFO - do you know the answer of 41 + 1?\n```\n\n### as a method decorator\n\n```python\n@log\ndef foo(x, y):\n    return x + y\n\n@log.debug\ndef bar():\n    return \"hello world\"\n\n@log.debug(return_level=log.info)\ndef baz(x):\n    return x*2\n\nfoo(1, 2)\n# ... INFO - foo called with args: (1, 2), kwargs: {}\n# ... DEBUG - foo returned: 3\nbar()\n# ... DEBUG - bar called with args: (), kwargs: {}\n# ... DEBUG - bar returned: hello world\nbaz(3)\n# ... DEBUG - baz called with args: (3,), kwargs: {}\n# ... INFO - baz returned: 6\n```\n\n### as a class decorator\n\n```python\n@log\nclass Foo:\n    def __init__(self, x):\n        self.x = x\n\n    def bar(self, y):\n        return self.x + y\n\n    @log.warn\n    def baz(self):\n        return self.x * 2\n\n\nfoo = Foo(1)\n# ... INFO - Instantiated Foo with args: (1,), kwargs: {}\nfoo.bar(2)\n# ... INFO - Foo.bar called with args: (2,), kwargs: {}\n# ... DEBUG - Foo.bar returned: 3\nfoo.baz()\n# ... WARNING - Foo.baz called with args: (), kwargs: {}\n# ... WARNING - Foo.baz returned: 2\n```\n\n### configurations shortcuts\n\n```python\nfile_formatter = log.Formatter(\"%(asctime)s - %(name)s - %(levelname)s - %(message)s\")\nlog.addFileHandler(\"foo.log\", fmt=file_formatter)\nlog.addStreamHandler(fmt=\"%(levelname)s - %(message)s\")\nlog.basicConfig(...)\n```\n\n### logging interface #not implemented yet\n\nI do plan to implement goatl's interaction with logging through an interface\nsuch that it will be possible to use goatl with any logging backend.\n\n```python\nlog.setBackend(logging)\nlog.setBackend(loguru)\nlogger = log.getLogger(\"foo\")\n```\n\n## core concepts\n\nIn order to justify the existence of goatl,\nit must fulfill three important core concepts:\n\n1. Unobtrusive - it should not interfere\\* with the existing code.\n2. Ease of use - using it should be intuitive and pythonic.\n3. Clean - the amount of code added to the existing code should be minimal.\n\n<sub>\\* - logging will always carry a performative cost, goatl will aim at keeping it to a minimum.</sub>\n\n### means\n\nextensive testing of goatl must be implemented to ensure that it does not interfere with the existing code.\nit should be tested by wrapping other popular libraries and modules with goatl.\nthis will ensure that goatl does not interfere with the existing code.\nperformance tests should be implemented to measure the performance cost of goatl,\nit should not exceed a reasonable threshold, in comparison to adding logging manually.\n\n### main features\n\nthe log function provides an easy interace for:\n\n- out of and in context log calls\n- wrapping existing functions with log calls\n- wrapping existing classes with log calls\n- wrapping existing modules with log calls #not implemented yet, is this even possible?\n- logging configuration #not implemented yet\n- support multiple logging backends #not implemented yet\n\nall in an intuitive and pythonic way.\n\n## Releases\n\nYou can see the list of available releases on the [GitHub Releases](https://github.com/EytanDn/goatl/releases) page.\n\n## License\n\n[![License](https://img.shields.io/github/license/Eytandn/goatl)](https://github.com/EytanDn/goatl/blob/master/LICENSE)\n\nThis project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/eytandn/goatl/blob/master/LICENSE) for more details.\n\n## Citation\n\n```bibtex\n@misc{goatl,\n  author = {goatl},\n  title = {goat logger},\n  year = {2023},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/EytanDn/goatl}}\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The goat logger",
    "version": "0.6.5",
    "project_urls": {
        "Homepage": "https://github.com/EytanDn/goatl",
        "Repository": "https://github.com/EytanDn/goatl"
    },
    "split_keywords": [
        "logging",
        "logger",
        "log",
        "goat",
        "goatl",
        "goatlogger",
        "goat-logger",
        "goat-logging",
        "goat-log"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c2ac1da666b8e3b61d99c6c03670bbbdac55f86bdb91c06b132bda4d950974f",
                "md5": "8dfd304144b6febd61c0a0bbaa62d53f",
                "sha256": "2e8e3fef840f1302e78849ed115659a97e96b2006420c64d441163ef293ed76c"
            },
            "downloads": -1,
            "filename": "goatl-0.6.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8dfd304144b6febd61c0a0bbaa62d53f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 8626,
            "upload_time": "2023-05-08T11:31:59",
            "upload_time_iso_8601": "2023-05-08T11:31:59.114306Z",
            "url": "https://files.pythonhosted.org/packages/2c/2a/c1da666b8e3b61d99c6c03670bbbdac55f86bdb91c06b132bda4d950974f/goatl-0.6.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f54e5d9106ff6cb0d5a99aeebe4115e3b2bf18f1b03ae60080c64fb0c3f2cb4",
                "md5": "ceebb05175f02a0477ca3f78f755ee2c",
                "sha256": "fa208852669ca2075d8e6f03c3060fc283ea16234984f1e1899351a421fa2f1e"
            },
            "downloads": -1,
            "filename": "goatl-0.6.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ceebb05175f02a0477ca3f78f755ee2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 10566,
            "upload_time": "2023-05-08T11:32:02",
            "upload_time_iso_8601": "2023-05-08T11:32:02.167737Z",
            "url": "https://files.pythonhosted.org/packages/9f/54/e5d9106ff6cb0d5a99aeebe4115e3b2bf18f1b03ae60080c64fb0c3f2cb4/goatl-0.6.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-08 11:32:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EytanDn",
    "github_project": "goatl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "goatl"
}
        
Elapsed time: 0.06091s