python-xlogs
logging toolkit
install
pip install xlogs
Usage
1. Use as decorator
from xlogs import log
if __name__ == '__main__':
# config_file: the logging config template, use the default if None
@log(log_dir='./logs',config_file=None)
def division():
pass
2. Load from ini config file
from xlogs import LogConfig
import logging
if __name__ == '__main__':
LogConfig(config_file= '/xxx.ini', log_file = '/xxx/')
logging.info('Default load to root')
info = logging.getLogger('root')
info.info('write msg to test.log')
info = logging.getLogger('test')
info.info('write msg to message.log')
info = logging.getLogger('info')
info.info('write msg to info.log')
error = logging.getLogger('error')
error.error('write msg to error.log')
# reload a new config file
LogConfig(config_file= '/yyy.ini', log_file = '/yyy/').reset()
logging.getLogger().info("info with new logger")
3. config with args
from xlogs import get_logger
if __name__ == '__main__':
logger = get_logger(debug=True, logfile='/message.log')
logger.info("info oooooo")
logger.debug("debug ggggg")
logger.error("err rrrr")
Release files for xlogs 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xlogs-1.0.3.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xlogs-1.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / xlogs-1.0.3.tar.gz
| Download URL | xlogs-1.0.3.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7e045fc960469e9c6558ceea627ef5eca3fa6480fac88de248a0285d52fe2bf
|
|
BLAKE2b-256 checksum How to use checksums |
b65b4a51014796d54d1bae76b1c8293b44858d87ff63fe01ed345189ce6ea319
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
|
Release files / xlogs-1.0.3-py2.py3-none-any.whl
| Download URL | xlogs-1.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e6cfe7376e1e008bb49c745716b845d710dc2baa427696028f06d66702fd4e22
|
|
BLAKE2b-256 checksum How to use checksums |
3ac562e54a017693755776f7efddebc36eddade84329bd5210969e13a4f0f064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
|