Froggius is a dumb easy logging tool for python
Project description
Froggius
Froggius is a dumb easy logging tool 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.
Installation
You can install Froggius with following command:
pip install froggius
Alternatively you can clone this repository and install then:
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:
from froggius.logger import 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)
- highliting (True by deafult, used to colorize [DBG] etc.)
- print_out (True by default, used to setup printing to console and stdout)
# Example normal logging
Froggius.debug('This is a normal debug log')
# This writes the log to a log file
Froggius.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])
# Example error
Froggius.error('This is an error log')
# This writes the error to a log file
Froggius.error('This is an error log', 'tests/example.log', print_out=False)
Using catching errors
Use the catching errors methode, to catch and handle unexpected errors, warnings etc:
@Froggius.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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file froggius-0.1.3.post1.tar.gz
.
File metadata
- Download URL: froggius-0.1.3.post1.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9b964e09854e7920719d967040ba5aa0f8e423a70593b65bcc9e580529e5e45 |
|
MD5 | a11b44360c12657f3f47330fd983cb83 |
|
BLAKE2b-256 | fabf4ec2efafc57a2c87796a73af5652b6bb522d8d73920ae0f04e8c9cb98477 |
File details
Details for the file froggius-0.1.3.post1-py3-none-any.whl
.
File metadata
- Download URL: froggius-0.1.3.post1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cc598f0cb73941feeefd46f2a5828abe55442cc29b307451cfdfa920ae4ccf8 |
|
MD5 | 7292eafe70b66af9631963a430d9b35c |
|
BLAKE2b-256 | 53b1c0996a2f73178d64ccf894bea76069d234e7c8f79a4e648655a4f6c55bf9 |