Name | EscribaLogger JSON |
Version |
1.22.3
JSON |
| download |
home_page | |
Summary | 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 |
upload_time | 2023-10-05 11:27:32 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.10 |
license | MIT |
keywords |
logging
logger
log
logs
drivers
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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](https://rich.readthedocs.io/en/stable/introduction.html) stdout handler
```python
from EscribaLogger import Log
Log.add_driver('stdout') # important!
Log.set_logger_name('CustomName')
Log.info('My info message')
# > [07/16/23 17:01:06] INFO CustomName - My info message
```
## Log file driver
```python
# 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
```python
# 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
1. init the pyenv:
- Windows: `python -m venv env --prompt escriba-logger-pyenv`
- Linux/Unix: `python3 -m venv env --prompt escriba-logger-pyenv`
1. activate pyenv:
- Windows (**CMD/PowerShell**): `env/Scripts/activate.bat`
- Windows (**GitBash/Cygwin**): `source env/Scripts/activate`
- Linux/Unix: `source env/bin/activate`
1. Install Dependencies:
- Windows (**CMD/PowerShell**): `python -m pip install -r requirements.dev.txt`
- Linux/Unix: `python -m pip install -r requirements.dev.txt`
## Tests
We are using [pytest](https://docs.pytest.org/en/7.4.x/) and [coverage.py](https://coverage.readthedocs.io/en/7.2.7/) to maintain this project.
You can run the tests by using:
```console
# Don't forget activate pyenv!!!
[~/EscribaLogger] -> source env/bin/activate
# run the pytests + coverage
(escriba-logger-pyenv) [~/EscribaLogger] -> python -m coverage run -m pytest -l -v
# it can be simplified using "coverage run -m pytest -l -v"
====================================test session starts ====================================
platform win32 -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0 -- C:\Users\strov\Documents\github\EscribaLogger\env\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\strov\Documents\github\EscribaLogger
configfile: pytest.ini
plugins: anyio-3.7.1, mock-3.11.1
collected 5 items
tests/unit/test_builtin_drivers.py::test_driver_stdout... PASSED [ 20%]
tests/unit/test_builtin_drivers.py::test_driver_stdout... PASSED [ 40%]
tests/unit/test_builtin_drivers.py::test_driver_file_s... PASSED [ 60%]
tests/unit/test_builtin_drivers.py::test_driver_file_s... PASSED [ 80%]
tests/unit/test_extra_content.py::test_extra_context_p... PASSED [100%]
===================================== 5 passed in 0.21s ===================================
Continue below...
```
the command above will generate the `.coverage` file in root path. Now you can generate the coverage report
```console
(escriba-logger-pyenv) [~/EscribaLogger] -> coverage report -m
OR
(escriba-logger-pyenv) [~/EscribaLogger] -> python -m coverage report -m
```
Or you can create a entire webpage to see the results:
```console
(escriba-logger-pyenv) [~/EscribaLogger] -> coverage html
```
Raw data
{
"_id": null,
"home_page": "",
"name": "EscribaLogger",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "logging logger log logs drivers",
"author": "",
"author_email": "Thiago Santa Clara Pereira <strovsk@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/7d/21/7f6da28903ce977657120f85ad45ca74b47f9cf903a9cb07f98e8ed3c335/escribalogger-1.22.3.tar.gz",
"platform": null,
"description": "# Get Started\n\n## install\n\n`python -m pip install EscribaLogger`\n\n## Usage\n\nJust import, add drivers and use:\n\n> You can output your logs using a pre-configured builtin [rich](https://rich.readthedocs.io/en/stable/introduction.html) stdout handler\n\n```python\nfrom EscribaLogger import Log\n\nLog.add_driver('stdout') # important!\nLog.set_logger_name('CustomName')\n\nLog.info('My info message')\n# > [07/16/23 17:01:06] INFO CustomName - My info message\n```\n\n## Log file driver\n\n```python\n# You can add another driver. In this case, we will add the file driver\nLog.add_driver('file')\n\n\nLog.info('Some message', extra={\"context_var\": \"value\"})\n# > The message will be stored in \"logs/2023-07-16.log\"\n# > [2023-07-16 16:13:55,100] EscribaLogger.INFO - Some message - {\"context_var\": \"value\"}\n```\n\n> 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.\n\n### Change default log files storage\n\n```python\n# You can change default path to store log files in:\nLog.add_driver('file', driver_option={'file_location': 'another/path'})\n\n\nLog.info('Some message', extra={\"context_var\": \"value\"})\n# > The message will be stored in \"another/path/2023-07-16.log\"\n# > [2023-07-16 16:13:55,100] EscribaLogger.INFO - Some message - {\"context_var\": \"value\"}\n```\n\n# Contributing\n\n## Setup env\n\n1. init the pyenv:\n\n - Windows: `python -m venv env --prompt escriba-logger-pyenv`\n - Linux/Unix: `python3 -m venv env --prompt escriba-logger-pyenv`\n\n1. activate pyenv:\n\n - Windows (**CMD/PowerShell**): `env/Scripts/activate.bat`\n - Windows (**GitBash/Cygwin**): `source env/Scripts/activate`\n - Linux/Unix: `source env/bin/activate`\n\n1. Install Dependencies:\n\n - Windows (**CMD/PowerShell**): `python -m pip install -r requirements.dev.txt`\n - Linux/Unix: `python -m pip install -r requirements.dev.txt`\n\n## Tests\n\nWe are using [pytest](https://docs.pytest.org/en/7.4.x/) and [coverage.py](https://coverage.readthedocs.io/en/7.2.7/) to maintain this project.\nYou can run the tests by using:\n\n```console\n# Don't forget activate pyenv!!!\n\n[~/EscribaLogger] -> source env/bin/activate\n\n# run the pytests + coverage\n(escriba-logger-pyenv) [~/EscribaLogger] -> python -m coverage run -m pytest -l -v\n# it can be simplified using \"coverage run -m pytest -l -v\"\n\n\n====================================test session starts ====================================\nplatform win32 -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0 -- C:\\Users\\strov\\Documents\\github\\EscribaLogger\\env\\Scripts\\python.exe\ncachedir: .pytest_cache\nrootdir: C:\\Users\\strov\\Documents\\github\\EscribaLogger\nconfigfile: pytest.ini\nplugins: anyio-3.7.1, mock-3.11.1\ncollected 5 items\n\ntests/unit/test_builtin_drivers.py::test_driver_stdout... PASSED [ 20%]\ntests/unit/test_builtin_drivers.py::test_driver_stdout... PASSED [ 40%]\ntests/unit/test_builtin_drivers.py::test_driver_file_s... PASSED [ 60%]\ntests/unit/test_builtin_drivers.py::test_driver_file_s... PASSED [ 80%]\ntests/unit/test_extra_content.py::test_extra_context_p... PASSED [100%]\n\n===================================== 5 passed in 0.21s ===================================\n\nContinue below...\n```\n\nthe command above will generate the `.coverage` file in root path. Now you can generate the coverage report\n\n```console\n(escriba-logger-pyenv) [~/EscribaLogger] -> coverage report -m\n\nOR\n\n(escriba-logger-pyenv) [~/EscribaLogger] -> python -m coverage report -m\n```\n\nOr you can create a entire webpage to see the results:\n\n```console\n(escriba-logger-pyenv) [~/EscribaLogger] -> coverage html\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "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",
"version": "1.22.3",
"project_urls": {
"Github": "https://github.com/Strovsk/EscribaLogger"
},
"split_keywords": [
"logging",
"logger",
"log",
"logs",
"drivers"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bd13b0c4d3d6e956daaf3f4bd9661801919acbb3842db4445b2bb25cfe200ffa",
"md5": "3b3db888b21ebee020c4a465010d6c25",
"sha256": "1460c16e7e028996baf823b3abec1351291a617fc976e7f0b4862bb83d8dc021"
},
"downloads": -1,
"filename": "escribalogger-1.22.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3b3db888b21ebee020c4a465010d6c25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6403,
"upload_time": "2023-10-05T11:27:30",
"upload_time_iso_8601": "2023-10-05T11:27:30.622085Z",
"url": "https://files.pythonhosted.org/packages/bd/13/b0c4d3d6e956daaf3f4bd9661801919acbb3842db4445b2bb25cfe200ffa/escribalogger-1.22.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d217f6da28903ce977657120f85ad45ca74b47f9cf903a9cb07f98e8ed3c335",
"md5": "50c2632f326dced98f2636cfc2b0598e",
"sha256": "9abdc43fd1c40974999cbc10da9fa4f46cdb3921b0a9787b0526f2f1c9937bc9"
},
"downloads": -1,
"filename": "escribalogger-1.22.3.tar.gz",
"has_sig": false,
"md5_digest": "50c2632f326dced98f2636cfc2b0598e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 7680,
"upload_time": "2023-10-05T11:27:32",
"upload_time_iso_8601": "2023-10-05T11:27:32.147628Z",
"url": "https://files.pythonhosted.org/packages/7d/21/7f6da28903ce977657120f85ad45ca74b47f9cf903a9cb07f98e8ed3c335/escribalogger-1.22.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-05 11:27:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Strovsk",
"github_project": "EscribaLogger",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "escribalogger"
}