|
1 | | -# python-bufflog |
2 | | -Python logger for Buffer services |
| 1 | +# Python Bufflog |
| 2 | + |
| 3 | +Python logger for Buffer services. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +You can use `pip` to install `bufflog`: |
| 8 | + |
| 9 | +```python |
| 10 | +pip install bufflog |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +```python |
| 16 | + |
| 17 | +import bufflog |
| 18 | + |
| 19 | +bufflog.debug('Hello debug', {"some":"stuff"}); |
| 20 | +bufflog.info('Hello info'); |
| 21 | +bufflog.notice('Hello notice with context', {"foo":"bar"}); |
| 22 | +bufflog.error('Hello error'); |
| 23 | +bufflog.critical('Hello critical'); |
| 24 | +``` |
| 25 | + |
| 26 | +## Log verbosity levels |
| 27 | + |
| 28 | +If you wish to see more logs, simply set the `LOG_LEVEL` to the desired level. Here a list with some use case: |
| 29 | + |
| 30 | +| Levels | Use case | Examples | |
| 31 | +| :------: | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | |
| 32 | +| DEBUG | Information used for interactive investigation, with no long-term value. Activate it with `LOG_LEVEL=DEBUG` | Printing function names, steps inside a function. | |
| 33 | +| INFO | Interesting events. Track the general flow of the application. Activate it with `LOG_LEVEL=INFO` | User logs in, SQL logs, worker process/delete a message... | |
| 34 | +| NOTICE | Uncommon events. **This is the default verbosity level**. | Missing environment variables, page redirection, pod starting/restarting/terminating, retrying to query an API... | |
| 35 | +| WARNING | Exceptional occurrences that are not errors. Undesirable things that are not necessarily wrong. | Use of deprecated APIs, poor use of an API, unauthorized access, pod restart because of memory limit ... | |
| 36 | +| ERROR | Runtime errors. Highlight when the current flow of execution is stopped due to a failure. | Exceptions messages, incorect credentials or permissions... | |
| 37 | +| CRITICAL | Critical conditions. Describe an unrecoverable application, system crash, or a catastrophic failure that requires immediate attention. | Application component unavailable, unexpected exception. entire website down, database unavailable ... | |
0 commit comments