Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ouest-france/sipy_logger
Programmatically creates python loggers with different handlers (console, file, graylog)
https://github.com/ouest-france/sipy_logger
logging python
Last synced: 7 days ago
JSON representation
Programmatically creates python loggers with different handlers (console, file, graylog)
- Host: GitHub
- URL: https://github.com/ouest-france/sipy_logger
- Owner: Ouest-France
- License: mit
- Created: 2018-11-26T10:56:00.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-27T11:07:41.000Z (about 6 years ago)
- Last Synced: 2024-12-14T05:18:58.707Z (2 months ago)
- Topics: logging, python
- Language: Python
- Size: 6.84 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sipy_logger
Programmatically creates python loggers with different handlers (console, file, graylog)# Install
Install from the github repository:
* with [pipenv](https://pipenv.readthedocs.io/en/latest/):
```sh
pipenv install git+https://github.com/Ouest-France/sipy_logger.git#egg=sipy_logger
```* with `pip`:
```sh
pip3 install git+https://github.com/Ouest-France/sipy_logger.git
```# Usage
* fully declare the logger in the root script (_eg._ `server.py`):
```python
from os import getenv
LOG_DIR = getenv('LOG_DIR')from sipy_logger import getLogger
logger = getLogger('myapplogger', fileDir=LOG_DIR, filename=datetime.now().strftime('%Y-%m-%d_%H:%M:%S.%m-myapp.log'))from ./routehandler import routehandler
# ...
logger.info('starting server, logging in %s', LOG_DIR)
```* re-use it in sub-scripts (_eg._ `routehandler.py`) that are imported by the root script:
```python
from sipy_logger import getLogger
logger = getLogger('myapplogger') # no need to re-specify the logger parameters, they would be ignored anywaylogger.info('handling route %s', aRoute)
```# Licence
Unless stated otherwise all works are:
* Copyright © Ouest-France/SIPA Tech
* licensed under the [MIT license](http://spdx.org/licenses/MIT.html), a copy of which is included [here](LICENSE)# Contributions
* [Thomas Girault](https://github.com/thomasgirault)
* [Luc Sorel-Giffo](https://github.com/lucsorel)Pull-requests are welcome and will be processed on a best-effort basis.