A log helper
Project description
A logger python project
,-----------------------------------------------------------------v
u ,-~~\ <~)_ u\ /\ ,-. ,-. u
u _,===-., ( \ ( v~\ u u _,===-., \/ <,- \_____/ ` u
u (______,. u\. \ \_/' \u (______,. /__\ / ___. \ -===- u
u _a_a`\\ /\ u \--/ ,_(__/ ,_(__\ u
`--------------------------------------------- By CenturyBoys ----y
This is a non block JSON logger that use python's default logger with a thread executor.
By default loglifos set the default root loger to ERROR level
Settings
You can change loglifos log level using set_config
method. Loglifos use the same level constants as the default logging python lib.
import loglifos
loglifos.set_config(loglifos.ERROR)
Using
import loglifos
try:
a = 1 / 0
except Exception as e:
loglifos.debug("Message from debug", "some args", 1, some__kwargs="Kwargs of debug")
loglifos.info("Message from info", "some args", 1, some__kwargs="Kwargs of info")
loglifos.warning("Message from warning", "some args", 1, some__kwargs="Kwargs of warning")
loglifos.error("Message from error", "some args", 1, some__kwargs="Kwargs of error", exception=e)
loglifos.critical("Message from critical", "some args", 1, some__kwargs="Kwargs of critical")
{"time": "2023-01-25 13:27:34.896765", "level": "ERROR", "file": "/home/marco/.config/JetBrains/PyCharmCE2022.3/scratche
s/scratch_1.py", "function": "<module>", "msg": "Message from error", "some__kwargs": "'Kwargs of error'", "args": "('
some args', 1)", "error": "Traceback (most recent call last):\n File \"/home/marco/.config/JetBrains/PyCharmCE2022.3/
scratches/scratch_1.py\", line 9, in <module>\n a = 1 / 0\nZeroDivisionError: division by zero\n"}
{"time": "2023-01-25 13:27:34.899420", "level": "DEBUG", "file": "/home/marco/.config/JetBrains/PyCharmCE2022.3/scratche
s/scratch_1.py", "function": "<module>", "msg": "Message from debug", "some__kwargs": "'Kwargs of debug'", "args": "('
some args', 1)"}
{"time": "2023-01-25 13:27:34.899676", "level": "INFO", "file": "/home/marco/.config/JetBrains/PyCharmCE2022.3/scratches
/scratch_1.py", "function": "<module>", "msg": "Message from info", "some__kwargs": "'Kwargs of info'", "args": "('som
e args', 1)"}
{"time": "2023-01-25 13:27:34.899885", "level": "WARNING", "file": "/home/marco/.config/JetBrains/PyCharmCE2022.3/scratc
hes/scratch_1.py", "function": "<module>", "msg": "Message from warning", "some__kwargs": "'Kwargs of warning'", "args
": "('some args', 1)"}
{"time": "2023-01-25 13:27:34.900066", "level": "CRITICAL", "file": "/home/marco/.config/JetBrains/PyCharmCE2022.3/scrat
ches/scratch_1.py", "function": "<module>", "msg": "Message from critical", "some__kwargs": "'Kwargs of critical'", "a
rgs": "('some args', 1)"}
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
loglifos-0.2.1.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file loglifos-0.2.1.tar.gz
.
File metadata
- Download URL: loglifos-0.2.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.1.0-25-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fad84e804e3229080ca79edccc93baaab7b48976a4d8c204d308fee220c2275 |
|
MD5 | f82458b8eb0930af6395cd71766a65b2 |
|
BLAKE2b-256 | 70ed294b0374644e065a010f50ee693520ae0dcc538cd546c342218fc9a5b6c8 |
File details
Details for the file loglifos-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: loglifos-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.1.0-25-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1caa6b69fe8920303737bf4001314b25ef0b1a9460ca2b32801943493af7087 |
|
MD5 | b8e708013773ee4f81376cce49940c7a |
|
BLAKE2b-256 | 163ab00a01da433a7fb6b2ed3ab217f5879a11c65fac17193a959031a04e9cb9 |