A fast 'read to use' Logging system which provides stdout/file/custom stream with easy syntax and operation. It's a very simple approach of Laravel drivers sorts, by the way, handlers ands drivers are both the same
Project description
Get Started
install
python -m pip install EscribaLogger
Usage
Just import, add drivers and use:
You can output your logs using a pre-configured builtin rich stdout handler
from EscribaLogger import Log
# Initilize
Log()
Log.set_logger_name('CustomName')
# Add drivers (stdout, file, graylog, flutend etc)
Log.add_driver('stdout')
Log.info('My info message', {'context_var': 'value'})
# > [01/12/25 20:30:20] INFO CustomName - My info message <stdin>:1
Log file driver
# You can add another driver. In this case, we will add the file driver
Log.add_driver('file')
Log.info('Some message', extra={"context_var": "value"})
# > The message will be stored in "logs/2023-07-16.log"
# > [2023-07-16 16:13:55,100] EscribaLogger.INFO - Some message - {"context_var": "value"}
In the default logging system, handle context variables is a exhausting task. EscribaLogger added the "extra_context" log variable to solve this. You add the context info for any custom driver.
Change default log files storage
# You can change default path to store log files in:
Log.add_driver('file', driver_option={'file_location': 'another/path'})
Log.info('Some message', extra={"context_var": "value"})
# > The message will be stored in "another/path/2023-07-16.log"
# > [2023-07-16 16:13:55,100] EscribaLogger.INFO - Some message - {"context_var": "value"}
Contributing
Setup env
- install pdm
python -m pip install pdm
- install dependencies
pdm install
Tests
We are using pytest and coverage.py to maintain this project. You can run the tests by using:
pdm run test:unit
the command above will generate the .coverage file in root path. Now you can generate the coverage report
Coverage
coverage report -m
Or you can create a entire webpage to see the results:
pdm run coverage html
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file escribalogger-2.0.3.tar.gz.
File metadata
- Download URL: escribalogger-2.0.3.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3526cee19167eed4ecf27ce5bb4d20a2ad861d8cca8b65a425cc04b9b0dc3682
|
|
| MD5 |
65e30723305c57accad566da685d87b5
|
|
| BLAKE2b-256 |
2a93f50f4d8943c93f7c95d00a179e932f325b8c027312926a30e2dca58c2ae3
|
File details
Details for the file escribalogger-2.0.3-py3-none-any.whl.
File metadata
- Download URL: escribalogger-2.0.3-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35dbd882609b64cfd34c606d455fe51525da0ea23b7ca7ad308d8c0f658ec01d
|
|
| MD5 |
b04da36fecf4c2ead195d67d99ffa261
|
|
| BLAKE2b-256 |
0874e0376b8d573b1353067aaf18360e12bf2a850a97d7c31eb34cf4fb5b8ae4
|