froggius


Namefroggius JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/zlElo/Froggius
SummaryFroggius is a lightweight and dumb easy logging libary for python
upload_time2024-04-27 11:28:08
maintainerNone
docs_urlNone
authorzlElo
requires_pythonNone
licenseMPL-2.0
keywords logging logger easy-to-use log
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img src="https://github.com/zlElo/Froggius/blob/main/res/froggius-cropped.png?raw=true" style="width: 200px">
</p>

<p align="center">
  <img src="https://img.shields.io/github/languages/code-size/zlElo/Froggius" alt="GitHub code size in bytes" />
  <img src="https://img.shields.io/github/last-commit/zlElo/Froggius" alt="GitHub last commit" />
  <img src="https://img.shields.io/github/commit-activity/m/zlElo/Froggius" alt="GitHub commit activity month" />
  <img src="https://img.shields.io/github/license/zlElo/Froggius" alt="GitHub license" />
  <a href="https://pepy.tech/project/structlog"><img src="https://static.pepy.tech/personalized-badge/froggius?period=month&units=international_system&left_color=grey&right_color=blue&left_text=Downloads%20/%20Month" alt="Downloads per month" /></a>
</p>

# Froggius
Froggius is a lightweight and dumb easy logging libary for python

---------

## Introduction
Froggius is a lightweight python libary, which is designed for easy to use logging for all your programs. It makes it easy for everybody, but also brings a lot of options to configure it like you need it. An very interesting feature for example is the error catching for functions, which makes it easy to log unexpected errors, warnings etc.

## Advantages of froggius
Froggius is like in the introduction already said very lightweight and designed for efficiency, which means that the speed of the logging is much faster than other libarys. How fast it is, can you see in this line chart:

<p align="center">
  <img src="https://github.com/zlElo/Froggius/blob/main/res/tests/froggius_exec.png?raw=true" style="width: 770px">
</p>

This example runs following debug command 60 times and prints every time the log to the console and stdout:
```py
logger.debug('Example Debug Message')
```

This massive speed improvement helps your program, to log like you need it without performance disadvantages.

System informations: MacOS Sonoma 14.4.1, MacBook Air M2, Python 3.12.1
## Installation
You can install Froggius with following command:
```
pip install froggius
```

Alternatively you can clone this repository and install then:
```bash
git clone https://github.com/zlElo/Froggius.git
cd Froggius
pip install .
```

## Usage
Here are examples for the usage of Froggius. Import statement is following:

```py
from froggius import Froggius

logger = Froggius()
```

### Using debugger/logger
Use it as debugger/logger with following possible arguments:
- log_msg (log message)
- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)
- print_out (True by default, used to setup printing to console and stdout)

```py
# Example normal logging
logger.debug('This is a normal debug log')

# This writes the log to a log file
logger.debug('This is a normal debug log', 'tests/example.log', print_out=False)
```

### Using with predefinied errors
Use it as error logger with following possible arguments:
- log_msg (log message)
- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)
- highliting (True by deafult, used to colorize [DBG] etc.)
- print_out (True by default, used to setup printing to console and stdout)
- line (None by default, expects list with following 3 items in this structure: [line number, file name, function name])

```py
# Example error
logger.error('This is an error log')

# This writes the error to a log file
logger.error('This is an error log', 'tests/example.log', print_out=False)
```

### Using information logger
Use it as information logger with following possible arguments:
- log_msg (log message)
- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)
- highliting (True by default, used to colorize [INF] etc.)
- print_out (True by default, used to setup printing to console and stdout)

```py
# Example information
logger.information('This is an information log')

# This writes the information to a log file
logger.information('This is an information log', 'tests/example.log', print_out=False)
```

### Using warning logger
Use it as warning logger with following possible arguments:
- log_msg (log message)
- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)
- highliting (True by default, used to colorize [WRN] etc.)
- print_out (True by default, used to setup printing to console and stdout)

```py
# Example warning
logger.warning('This is a warning log')

# This writes the warning to a log file
logger.warning('This is a warning log', 'tests/example.log', print_out=False)
```

### Using catching errors
Use the catching errors methode, to catch and handle unexpected errors, warnings etc:

```py
@logger.catch(file_path='tests/example.log')
def example_function():
    """
    Information: Not working function, because of division by zero
    """
    var1 = 5
    var = 0

    result = var1 / var
    print(result)

example_function()
```

Output in log file:
`
[ERR] [01/04/2024 09:15:00] division by zero | Occured on line: 28 in /Users/username/path/examples.py, example_function()
`

### Using global configuration
If you want to configure the file_path and the print_out for everything, you can do that with following line before all other Froggius statements:

```py
# configure print_out and file_path for everything
logger = Froggius(print_out=False, file_path='tests/example.log')

logger.debug('Test normal')
logger.error('Test error')
logger.information('Test information')
```

It's also possible to say, that you want that all is not printed, but this `logger.debug('Test normal')` or `logger.information('Test information')`. Just work with the available parameters:

```py
# configure print_out and file_path for everything
logger = Froggius(print_out=False, file_path='tests/example.log')

logger.debug('Test normal', print_out=True) # everything is not printed, but this line is printed
logger.error('Test error')
logger.information('Test information')
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zlElo/Froggius",
    "name": "froggius",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "logging, logger, easy-to-use, log",
    "author": "zlElo",
    "author_email": "mail@zlelo.de",
    "download_url": "https://files.pythonhosted.org/packages/f1/b7/20c27c532beff54fab7c6ffa0327786f058926e710c59ea9e65ce0bd27d7/froggius-0.1.7.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img src=\"https://github.com/zlElo/Froggius/blob/main/res/froggius-cropped.png?raw=true\" style=\"width: 200px\">\n</p>\n\n<p align=\"center\">\n  <img src=\"https://img.shields.io/github/languages/code-size/zlElo/Froggius\" alt=\"GitHub code size in bytes\" />\n  <img src=\"https://img.shields.io/github/last-commit/zlElo/Froggius\" alt=\"GitHub last commit\" />\n  <img src=\"https://img.shields.io/github/commit-activity/m/zlElo/Froggius\" alt=\"GitHub commit activity month\" />\n  <img src=\"https://img.shields.io/github/license/zlElo/Froggius\" alt=\"GitHub license\" />\n  <a href=\"https://pepy.tech/project/structlog\"><img src=\"https://static.pepy.tech/personalized-badge/froggius?period=month&units=international_system&left_color=grey&right_color=blue&left_text=Downloads%20/%20Month\" alt=\"Downloads per month\" /></a>\n</p>\n\n# Froggius\nFroggius is a lightweight and dumb easy logging libary for python\n\n---------\n\n## Introduction\nFroggius is a lightweight python libary, which is designed for easy to use logging for all your programs. It makes it easy for everybody, but also brings a lot of options to configure it like you need it. An very interesting feature for example is the error catching for functions, which makes it easy to log unexpected errors, warnings etc.\n\n## Advantages of froggius\nFroggius is like in the introduction already said very lightweight and designed for efficiency, which means that the speed of the logging is much faster than other libarys. How fast it is, can you see in this line chart:\n\n<p align=\"center\">\n  <img src=\"https://github.com/zlElo/Froggius/blob/main/res/tests/froggius_exec.png?raw=true\" style=\"width: 770px\">\n</p>\n\nThis example runs following debug command 60 times and prints every time the log to the console and stdout:\n```py\nlogger.debug('Example Debug Message')\n```\n\nThis massive speed improvement helps your program, to log like you need it without performance disadvantages.\n\nSystem informations: MacOS Sonoma 14.4.1, MacBook Air M2, Python 3.12.1\n## Installation\nYou can install Froggius with following command:\n```\npip install froggius\n```\n\nAlternatively you can clone this repository and install then:\n```bash\ngit clone https://github.com/zlElo/Froggius.git\ncd Froggius\npip install .\n```\n\n## Usage\nHere are examples for the usage of Froggius. Import statement is following:\n\n```py\nfrom froggius import Froggius\n\nlogger = Froggius()\n```\n\n### Using debugger/logger\nUse it as debugger/logger with following possible arguments:\n- log_msg (log message)\n- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)\n- print_out (True by default, used to setup printing to console and stdout)\n\n```py\n# Example normal logging\nlogger.debug('This is a normal debug log')\n\n# This writes the log to a log file\nlogger.debug('This is a normal debug log', 'tests/example.log', print_out=False)\n```\n\n### Using with predefinied errors\nUse it as error logger with following possible arguments:\n- log_msg (log message)\n- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)\n- highliting (True by deafult, used to colorize [DBG] etc.)\n- print_out (True by default, used to setup printing to console and stdout)\n- line (None by default, expects list with following 3 items in this structure: [line number, file name, function name])\n\n```py\n# Example error\nlogger.error('This is an error log')\n\n# This writes the error to a log file\nlogger.error('This is an error log', 'tests/example.log', print_out=False)\n```\n\n### Using information logger\nUse it as information logger with following possible arguments:\n- log_msg (log message)\n- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)\n- highliting (True by default, used to colorize [INF] etc.)\n- print_out (True by default, used to setup printing to console and stdout)\n\n```py\n# Example information\nlogger.information('This is an information log')\n\n# This writes the information to a log file\nlogger.information('This is an information log', 'tests/example.log', print_out=False)\n```\n\n### Using warning logger\nUse it as warning logger with following possible arguments:\n- log_msg (log message)\n- file_path (None by default, used to set up a log file [...] to append to this file. The file does not have to already exist, if it does not exist, it will be created)\n- highliting (True by default, used to colorize [WRN] etc.)\n- print_out (True by default, used to setup printing to console and stdout)\n\n```py\n# Example warning\nlogger.warning('This is a warning log')\n\n# This writes the warning to a log file\nlogger.warning('This is a warning log', 'tests/example.log', print_out=False)\n```\n\n### Using catching errors\nUse the catching errors methode, to catch and handle unexpected errors, warnings etc:\n\n```py\n@logger.catch(file_path='tests/example.log')\ndef example_function():\n    \"\"\"\n    Information: Not working function, because of division by zero\n    \"\"\"\n    var1 = 5\n    var = 0\n\n    result = var1 / var\n    print(result)\n\nexample_function()\n```\n\nOutput in log file:\n`\n[ERR] [01/04/2024 09:15:00] division by zero | Occured on line: 28 in /Users/username/path/examples.py, example_function()\n`\n\n### Using global configuration\nIf you want to configure the file_path and the print_out for everything, you can do that with following line before all other Froggius statements:\n\n```py\n# configure print_out and file_path for everything\nlogger = Froggius(print_out=False, file_path='tests/example.log')\n\nlogger.debug('Test normal')\nlogger.error('Test error')\nlogger.information('Test information')\n```\n\nIt's also possible to say, that you want that all is not printed, but this `logger.debug('Test normal')` or `logger.information('Test information')`. Just work with the available parameters:\n\n```py\n# configure print_out and file_path for everything\nlogger = Froggius(print_out=False, file_path='tests/example.log')\n\nlogger.debug('Test normal', print_out=True) # everything is not printed, but this line is printed\nlogger.error('Test error')\nlogger.information('Test information')\n```\n",
    "bugtrack_url": null,
    "license": "MPL-2.0",
    "summary": "Froggius is a lightweight and dumb easy logging libary for python",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/zlElo/Froggius"
    },
    "split_keywords": [
        "logging",
        " logger",
        " easy-to-use",
        " log"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9cc8f960445b54eaf2bb4a3e3e06a22420234d94027ffc94c131c351cc3504a8",
                "md5": "52605d257116831901c19e46e7fa6133",
                "sha256": "5a17e0dc789ef004caac92b294fdcbf8da16e9f7c6a2d41c8fb0717621362418"
            },
            "downloads": -1,
            "filename": "froggius-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "52605d257116831901c19e46e7fa6133",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10630,
            "upload_time": "2024-04-27T11:28:04",
            "upload_time_iso_8601": "2024-04-27T11:28:04.652595Z",
            "url": "https://files.pythonhosted.org/packages/9c/c8/f960445b54eaf2bb4a3e3e06a22420234d94027ffc94c131c351cc3504a8/froggius-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1b720c27c532beff54fab7c6ffa0327786f058926e710c59ea9e65ce0bd27d7",
                "md5": "72ddcaf661a938fa91c834515eb994df",
                "sha256": "c7875145cece11a92d54ad84661d14427832894b6d44107e35ab1b8c8c68d261"
            },
            "downloads": -1,
            "filename": "froggius-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "72ddcaf661a938fa91c834515eb994df",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10342,
            "upload_time": "2024-04-27T11:28:08",
            "upload_time_iso_8601": "2024-04-27T11:28:08.299014Z",
            "url": "https://files.pythonhosted.org/packages/f1/b7/20c27c532beff54fab7c6ffa0327786f058926e710c59ea9e65ce0bd27d7/froggius-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-27 11:28:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zlElo",
    "github_project": "Froggius",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "froggius"
}
        
Elapsed time: 3.61811s