ezlog
Modern, simple in use, fast, colored logging library for python.
- Formatting support
- Stdout\Stderr\File handlers
- Easy to use & add custom handlers
- Colored and customizable
Installation
You can install this via pip (Windows):
pip install ezloglib
And also for linux systems:
pip3 install ezloglib
Read more about this on the documentation
Examples
Example from the documentation.
File: examples/presentation.py
import ezlog
import math
# declare stdout handler with log level - debug
sout_handler = ezlog.StdoutHandler(log_level='debug')
# initialize main logger
main_logger = ezlog.Logger('Main', handlers=[sout_handler])
# examples of the default log levels
main_logger.debug('This is {} message', 'debug')
main_logger.exception('This is {} message', 'exception')
main_logger.info('This is {} message', 'info')
main_logger.warning('This is {} message', 'warning')
main_logger.error('This is {} message', 'error')
main_logger.critical('This is critical message')
# pretty formatting + colored types
main_logger.debug('Int: {} List: {} Dict: {}', 13, [1, 2, 3], {'hello': 'world'})
main_logger.exception('Tuple: {} Bool: {} Bytes: {}', ('hello', 'world'), True, b'whois?')
main_logger.info('Float: {}', math.pi)
main_logger.warning('Exception (color): {}', NameError("name 'abc' is not defined"))
# example of the formatting
main_logger.info('{:<20}--{:>19}', 'pi is', f'{math.pi:.2f}')
# example exception logging
try:
printt('Hello, world!')
except Exception as e:
# NOTE: You can use also debug, critical and other log levels to print exception
main_logger.exception('Exception example', exception=e)
main_logger.info('It is continue work')
File: examples/groups_filelogging.py
import ezlog
# declare stdout handler with log level - debug
file_handler = ezlog.FileHandler('example.log', log_level='debug')
sout_handler = ezlog.StdoutHandler(log_level='info') # recommended: exception log level as default
# initialize example groups
example_group = ezlog.LoggerGroup('Example', handlers=[sout_handler, file_handler])
groups_group = ezlog.LoggerGroup('Groups', parent=example_group)
main_logger = ezlog.Logger('Main', group=groups_group)
# examples of the default log levels
main_logger.debug('This is {} message', 'debug')
main_logger.exception('This is {} message', 'exception')
main_logger.info('This is {} message', 'info')
main_logger.warning('This is {} message', 'warning')
main_logger.error('This is {} message', 'error')
main_logger.critical('This is critical message')
Metadata
Release files for ezloglib 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ezloglib-1.0.1.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ezloglib-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / ezloglib-1.0.1.tar.gz
| Download URL | ezloglib-1.0.1.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e571399db50d61a83588802c8911cc2d0e8545fb4f37d5a9d6f5286bf2e6c9d6
|
|
BLAKE2b-256 checksum How to use checksums |
0d2c4b51a550b825718d4926ca69856ed778bc04aaa11931dae62b9a55948899
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / ezloglib-1.0.1-py3-none-any.whl
| Download URL | ezloglib-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc380f10a99dbf19d7f5368724243fdb3486de45e1c21eeb86abbf5bb588fdcb
|
|
BLAKE2b-256 checksum How to use checksums |
33b861875e2b4ddd44a36c7ddaf5eb29aceb39d029d82ad692923cccdb17425e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|